Lazy loading error in R package - r

I am building R package in R version 3.1.3, but whenever i try to install it I get the following error message;
* installing *source* package ‘SPO’ ...
** R
** data
*** moving datasets to lazyload DB
** preparing package for lazy loading
Error : argument "data" is missing, with no default
Error : unable to load R code in package ‘SPO’
ERROR: lazy loading failed for package ‘SPO’
* removing ‘/home/evans/Desktop/SPO.Rcheck/SPO’
Kindly any help on how to fix lazy loading problem will be highly appreciated. Thank you.

This error message also occurs if you have uncommented code in the function file that is outside of the function definition.
The solution is to comment out, or delete, the code that is not inside your function.

In my case, I found an inactive/unused R file in the R folder of the package I wanted to build.
Once I deleted/removed this file, I was able to build the package.

The error is usually caused by missing arguments (as stated in the comments) or packages.
For example, I had the following in my package:
library("DESeq2")
I couldn't build and install my package because the package DESeq2 was not installed. Once I installed the package, everything worked.

Inspired by madsR suggestion I have deleted .RData and .Rhistory files from the package folder. Then the error kindly disappeared.

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 ggbiplot installation errer

I know this is a recurrent issue. However, going through all the hits when I google still has not helped me solve the issue. I hope someone can help: Her is what I do:
1: I run
install.packages('devtools')
library(devtools)
This appears to run all right. At least I do not get any error messages.
2: then I do:
install_github('vqv/ggbiplot', force=TRUE)
Then the errors messages comes:
install_github('vqv/ggbiplot', force=TRUE)
Downloading GitHub repo vqv/ggbiplot#master
√ checking for file 'C:\Users\jada\AppData\Local\Temp\RtmpgvAEpK\remotes28461c455b1\vqv-ggbiplot-7325e88/DESCRIPTION' ...
- preparing 'ggbiplot':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- looking to see if a 'data/datalist' file should be added
- building 'ggbiplot_0.55.tar.gz'
Installing package into ‘C:/Users/jada/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing source package 'ggbiplot' ...
** using staged installation
** R
** data
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package 'ggplot2' was built under R version 3.6.1
Execution halted
ERROR: lazy loading failed for package 'ggbiplot'
* removing 'C:/Users/jada/Documents/R/win-library/3.6/ggbiplot'
Error: Failed to install 'ggbiplot' from GitHub:
(converted from warning) installation of package ‘C:/Users/jada/AppData/Local/Temp/RtmpgvAEpK/file28421d56f74/ggbiplot_0.55.tar.gz’ had non-zero exit status
If anyone could sort me out here, I would be very happy.
Thank you.
jd
I suggest you to go in the path of the library in your computer (should be c:/Users/jada/Documents/R/win-library/3.6/) and delete the ggbiplot folder. After this, redo the installation process.
In this way you remove every possible problem conflict.
If this doesn't work out try also to delete ggbiplot_0.55.tar.gz in the Temp folder as suggested in the error.
I know it is an old question, but I have found a solution in here, and just in case the link does not work, here is the possible solution:
install.packages("remotes")
remotes::install_github("vqv/ggbiplot")

Failing to install Kieran Healy's 'socviz' package from github using devtools

I am trying to follow along with the online data viz resource by Kieran Healy (socviz.co), and have had minimal trouble setting things up to do so. I cannot seem to successfully install his 'socviz' package. This is the code Healy suggests:
devtools::install_github('kjhealy/socviz')
This returns:
ERROR: dependency 'rlang' is not available for package 'socviz'
* removing 'C:/Users/annem/OneDrive/Documents/R/win-library/3.4/socviz'
Installation failed: Command failed (1)
I tried removing and reinstalling 'rlang', but I still received the same error. I have also tried restarting R.
When reinstalling 'rlang', I get the following:
package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘rlang’
And when trying to load:
library(rlang)
Error in library(rlang) : there is no package called ‘rlang’
I'm using R v 3.4.2 on Windows 10.
I'm relatively new to R, so if there's a seemingly obvious solution (or you think it could be solved by doing something I've already done) let me know!
It's very possible I'm making a silly mistake, but I haven't found it myself. Any help is appreciated!
Turns out the problem was in how I was removing 'rlang'. I was attempting to using remove.packages() while the package was loaded into my session. I deleted it from my machine directly, but as Tung mentioned, using the remove.packages() command works as long as it is not loaded into the current R session.
Lesson learned--thanks!

Installing xml2 in R in Fedora 27

I'm having trouble installing xml2 in RStudio, running Fedora 27. On running install.packages('xml2'), I get the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp2sKZQZ/R.INSTALL689b37bd918d/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
I noticed in my /usr/lib64/, I have libicui18n.so.57 only, so I tried copying a libicui18n.so.58 there, and I got the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp908Ecf/R.INSTALL653812e0e41f/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicuuc.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
And I noticed the same problem -- I have version .57, not version .58 of this library as well. Before I repeat this over and over, is this in fact a shared library problem? Or, is there a way to fix this all at once?
I have xml2 installed (libxml2-devel-2.9.5-2.fc27.x86_64) already.
Since no one answered this yet and I've found a hacky solution, I thought I'd give an update on what worked.
It appears that my issue was that, even upon installing libxml2-devel, the version of the libraries I had in /usr/lib64 were not the same version required by RStudio's xml2 package. For example, regarding the particular package being mentioned in my question above, libicuuc.so.58, only libicuuc.so.57 could be found in /usr/lib64.
Running locate libicuuc.so.58, I found that anaconda3 has the correct versions of the libraries, so I got around the above problem temporarily by simply adding ~/anaconda3/lib to $LD_LIBRARY_PATH, roughly following instructions here.
This is a bit hacky, but led to successful installation.
Edit (IMPORTANT): Adding ~/anaconda3/lib to LD_LIBRARY_PATH in .bashrc caused a login loop, presumably because Fedora was trying to use the wrong libraries. To fix this, I added the lines:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ryi/anaconda3/lib/
export LD_LIBRARY_PATH
to R_HOME/etc/ldpaths.
I have solved this problem by install the ICU4C by source:
downloading ICU4C 58.2 from: ICU-Project
compiled
added the library location to $LD_LIBRARY_PATH,
the install will be work.

subscript out of bounds of my own R Package

New to creating my own R package to store my functions somewhere. I've had issues with this and have since deleted and unstalled it a few times to move it around and try to get it to work. It's currently sitting in a Microsoft OneDrive folder.
* installing *source* package 'MyPackage' ...
** R
** preparing package for lazy loading
Error in db[, "Version"] : subscript out of bounds
ERROR: lazy loading failed for package 'MyPackage'
* removing 'C:/Users/jsmith/Documents/R/R-3.4.1/library/MyPackage'
* restoring previous 'C:/Users/jsmith/Documents/R/R-3.4.1/library/MyPackage'
The package information sits in my OneDrive folder as I mentioned, and I use add R scripts and update from there, using roxygen2 and devtools. Still new at this but having a hard time when I'm trying to update the whole package so that everything shows up. And if I have a remote machine that has access to the OneDrive folder, I'm still having an issue installing the package.
Hoping for your help!
Thanks
Your DESCRIPTION file does not have a 'Version:' line.

Resources