I have built a local package to handle some data manipulations that I commonly use. My file structure is:
-RExample/
-- adhoc.R
-- DESCRIPTION
-- man/
--- function1.Rd
--- function2.Rd
-- NAMESPACE
-- R/
--- src_code_1.R
RExammple.Rproj
Using oxygen2, I build the package:
package_dir = "/direct/path/here/R/RExample/"
build(package_dir, path=package_dir)
The package builds correctly (man files are generated, namespace file has export() statements, I've updated the D.
build(package_dir, path=package_dir)
── R CMD build ──────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/direct/path/here/R/RExample/DESCRIPTION’
─ preparing ‘RExample’:
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
Removed empty directory ‘RExample/research_paper/inputs’
─ building ‘RExample_0.1.0.tar.gz’
[1] "/direct/path/here/R/RExample_0.1.0.tar.gz"
I am trying to install this package so I can use it in a totally separate project using:
install.packages("/direct/path/here/R/RExample_0.1.0.tar.gz)
Why am I getting this error and how to solve?
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Error in use_namespace() : could not find function "use_namespace"
Error: unable to load R code in package ‘RExample’
Execution halted
ERROR: lazy loading failed for package ‘RExample’
* removing ‘/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/RExample’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/RExample’
Warning in install.packages :
installation of package ‘direct/path/here/R/RExample_0.1.0.tar.gz’ had non-zero exit status
When I run RMD check . I get this error:
* using R version 4.3.1 (2023-06-16)
* using platform: aarch64-apple-darwin20 (64-bit)
* R was compiled by
Apple clang version 14.0.0 (clang-1400.0.29.202)
GNU Fortran (GCC) 12.2.0
* running under: macOS Ventura 13.6
* using session charset: UTF-8
* checking for file ‘./DESCRIPTION’ ... ERROR
File DESCRIPTION does not exist
* DONE
Status: 1 ERROR
See
‘/Users/sam/Documents/R/RExample/..Rcheck/..Rcheck/00check.log’
for details.
But here is my DESCRIPTION:
Package: RExample
Type: Package
Title: R and LaTeX Research Template
Version: 0.1.0
Authors@R:
person("Name", "Surname", email = "[email protected]", role = c("aut", "cre"))
Maintainer: Name Surname <[email protected]>
Description: R and LaTeX data processing, analysis, and modeling package for research purposes.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3