Reputation: 309
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.
Upvotes: 27
Views: 89045
Reputation: 338
I had the same error for installing package gt
. The problem was that my magrittr
should have been updated before loading gt
. But trying to updating that also didn't work and adding True for dependencies and closing and re-opening of RStudio also not helped me.
So, I tried to clear my environment in RStudio because there seemed to be an error related to that, and then everything worked fine.
Upvotes: 0
Reputation: 914
Inspired by madsR suggestion I have deleted .RData and .Rhistory files from the package folder. Then the error kindly disappeared.
Upvotes: 1
Reputation: 125
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.
Upvotes: 3
Reputation: 1479
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.
Upvotes: 14
Reputation: 8116
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.
Upvotes: 2