How do I get around the error in R package building - r

I built a R package using the build command shown below but now I can't build another with it. Please inform me on what is causing the error. The code is as follows:
C:\Users\abu\Documents> R CMD build analysiscb
The system cannot find the path specified.
checking for file 'analysiscb/DESCRIPTION' ... OK
preparing 'analysiscb':
checking DESCRIPTION meta-information ... OK
installing the package to process help pages
-----------------------------------
The system cannot find the path specified.
installing source package 'analysiscb' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'analysiscb'
finding HTML links ... done
analysiscb-package html
bcr.decide html
npv.eval html
rbcr html
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
DONE (analysiscb)
-----------------------------------
ERROR: package installation failed
C:\Users\abu\Documents>

Somehow I renamed the functions, rerun the package skeleton and accessed the cmd as the administrator. Touché! It was successful.

Related

R package development problem, unable to install my R package

I run R CMD check "folderlocation" to check my R package and I get the following in the result Git.Rcheck folder within the install.out file.
** installing source package 'SAEplus' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Error: package slot missing from signature for generic 'extent'
and classes sf
cannot use with duplicate class names (the package may need to be re-installed)
Execution halted
ERROR: lazy loading failed for package 'SAEplus'
** removing 'D:/Ify/Git/Git.Rcheck/SAEplus'
Does anyone know why this might be happening? I have gone as far as deleting all data from my data folder. There are no function examples in the R folder. The R folder only contains functions with their function documentation code.

R install.package fails on data-raw file not found

I am building an R package, with some associated data. I have created a data-raw folder using usethis:: functions, put various txt fies there, and built out R code to generate the .rda/Rdata files. I have used the use_data() function to generate the .rda and Rdata files and these I can see in /data.
I can retrieve these objects using load_all().
I then build a source package, which generates a compressed-tar-ball.
Finally I attempt to install that tar-ball/package in another project and get:
devtools::install_local("/home/fred/Rprojects/evidently/evidently_0.0.2.1.tar.gz")
✓ checking for file ‘/tmp/Rtmp53yb8S/remotes2eaf7a4fc2cb/evidently/DESCRIPTION’ ...
─ preparing ‘evidently’:
✓ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘evidently_0.0.2.1.tar.gz’
Installing package into ‘/home/rob/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘evidently’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error : **'/tmp/Rtmp0PbObQ/R.INSTALL391126f5cc7c/evidently/data-raw/TPBULET-A.txt' does not exist.**
Error: unable to load R code in package ‘evidently’
Execution halted
ERROR: lazy loading failed for package ‘evidently’
* removing ‘/home/fred/R/x86_64-pc-linux-gnu-library/4.0/evidently’
* restoring previous ‘/home/rob/R/x86_64-pc-linux-gnu-library/4.0/evidently’
Error: Failed to install 'evidently' from local:
(converted from warning) installation of package ‘/tmp/Rtmp53yb8S/file2eaf5f6ca68c/evidently_0.0.2.1.tar.gz’ had non-zero exit status
>
But the file it says it is looking for is in data-raw in the package folder.
I am missing something obvious here. I would welcome suggestions on why the system is not seeing the txt file, and why it is therefore aborting the install.
This happens when you have a rogue link to the data-raw file, in a file you thought you had purged, and when it gets loaded as part of install-packages, it tries to find a file in data-raw/ that is not there in the package, because data-raw/ is not part of the package, just in the source code. So, search your files and find the forgotten bit of code. Hang head in shame.

R install package tabplot

When I install R package, tabplot, below message has come.
My R version has updated 4.0.4 because 4.0.2 had same error.
error message is below)
Warning in install.packages :
package ‘tabplot’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Could you pls share how to resolve this issue?
Let's go meta for a moment:
What are you trying to do? Do you have a particular function in that archived package that you are hoping to apply to your dataset? ( which would imply that we needed to know which function. ... and a bunch of other questions.)
Or is this an effort to follow a blog or tutorial from the Web? (Again which one?)
I see this when I execute:
> install.packages("tabplot")
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘tabplot’ is not available (for R version 3.6.3)
So at this point my guess is that the tabplot maintainer has not keep pace with the evolution of R. Because ... packages that depend on the syntax or the behavior of core R functions or the CRAN rules that might change over time depending on the considered decisions of the R Core and CRAN. That's just the way it is. There's a further sort of language/system evolution that Hadley spawned.(ggplot and magrittr/ddplyr/rlang). (Arguably the S4 tributary is in the same category. The last CRAN-accepted version was downloadable from: <search-for exact URL> at 'an URL to be named later"' produces "Archived on 2020-02-19 as check problems were not corrected despite reminders." So that's pretty recent. Perhaps we can just download a copy of the most recent "tabplot-xx.xx.xx.xx.tar.gz" file from the CRAN archive and install from local source. (Note: need to use repo=NULL in the install.packages call.)
Well, that's not working yet because of an unmet dependency on an object named clone from package:ff.
install.packages("~/Downloads/tabplot/", repos =NULL)
#--------------
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘tabplot’ ...
** package ‘tabplot’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error: object ‘clone’ is not exported by 'namespace:ff'
Execution halted
ERROR: lazy loading failed for package ‘tabplot’
* removing ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/tabplot’
So perhaps you can live with some drop-in R code from the expanded source on the CRAN Archive?
EDIT: So I tried figuring out how to handle that sort of error and finally decided to try changing the NAMESPACE file. It's a text file that names various functions and where the program should find them. The two lines I needed to change were the ones importing ff:::clone and ff:::is.factor.ff so change them to
importFrom(bit, clone) # the bit package has an exported version
importFrom(ff, is.factor) # removed the `.ff` from its name
And now I get:
install.packages("~/Downloads/tabplot/", repos =NULL)
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘tabplot’ ...
file ‘NAMESPACE’ has the wrong MD5 checksum
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (tabplot)
The warning message is because I edited the NAMESPACE file but didn't do a full rebuild. Also note that you will not need the Rtools on a Windoze machine or the XCode and CLT on a Mac because there is no compiled code in this package.
It does appear that most of my efforts are paralleling the changes being made to the github version. See https://github.com/mtennekes/tabplot/issues/21 where the is.factor.ff issue was addressed 2 days ago. The author/maintainer says the package will be resubmitted to CRAN.
Despite claims that resubmission will occur. there does not seem to be any progress on that front. https://cran-archive.r-project.org/web/checks/2020/2020-02-19_check_results_tabplot.html However the github page suggests an installation via devtools and that succeeds for version 1.4.1 on an Ubuntu machine, despite the reports of errors in the earlier version that had been submitted to CRAN.

“Non Zero Exit Status” R 3.6.0 "Biobase"

I need to install different packages on R. The OS is ubuntu for windows. When I try "BiocManager::install("Biobase") I get the following error:
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
mv: cannot move '/home/mark/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-Biobase/00new/Biobase' to '/home/mark/R/x86_64-pc-linux-gnu-library/3.6/Biobase': Permission denied
ERROR: moving to final location failed
There seems to be something wrong with the permission to move certain files.. I already tried giving permission to write for everyone into the /3.6 directory, This didn't change anything.
Any solutions?
Apparently, this is a new feature in 3.6. But this should solve your problem:
Sys.setenv(R_INSTALL_STAGED = FALSE)

R - devtools - Build - ZIP failure?

I have been trying to build a package in R using the package devtools and the build function but it keeps failing on the zip element despite having the zip package installed?
* installing to library
'C:/Users/OMICRON/AppData/Local/Temp/Rtmpc30Top/temp_libpath133c19a632ea'
* installing *source* package 'simTools' ...
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'simTools'
finding HTML links ... done
sampleFromData html
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* MD5 sums
Warning in system(paste(shQuote(ZIP), "-r9Xq", filepath, paste(curPkg,
collapse = " "))) :
'"zip"' not found
running 'zip' failed
* DONE (simTools)
In R CMD INSTALL
[1] "D:/R/simTools_0.0.0.9000.zip"
My guess is that zip is referring to the Linux zip command and not the zip package.
Do you have R-tools installed? That includes a number of Linux commands and is necessary for building packages on Windows. It also needs to be included to your PATH (System Properties -> Environment Variables). You can check if it is properly set up using devtools::find_rtools().

Resources