I'm working in a package (and I'll include more later), and I'm doing a lot of changes and using it, and I'm looking for a method to can load the library without compile it, the lib is written in R.
I think the next structure:
Code
libs/
test_pkg1/
test_pkg2/
more code.R
Where the test_pkg are the dirs with the packages, they are already in the pkg format for R, the wd is set inside "Code", and then add "libs" to the library path in R, but R does not detect it.
I'm trying to use the libs in this both ways:
test_pkg1::func()
test_pkg2::func()
library(test_pkg1)
library(test_pkg2)
for the library
, I can use devtools::load_all(path)
, and works great, but I don't want to mix the env with other funcs, so I need the other way too.
I'm not trying to use both at the same time, but I need both, the most important for this is the ::
method.
I tested the libPath from here: Change R default library path using .libPaths in Rprofile.site fails to work
But I can't do it works...., using that I get the next result:
.libPaths( c( .libPaths(), "./libs") )
test_pkg1::func()
Error in namespaceExport(ns, exports) : undefined exports: func()
Although: Warning message:
In loadNamespace(name) : package ‘test_pkg1’ has no 'package.rds' in Meta/
Note, If I install the package, all works fine, the NAMESPACE file, contains the export functions, in any case, any error there and I should not be able to install and use the libs.
Thx.
Tests from comments:
Try library(pkg, lib.loc)
library("test_pkg1", lib.loc="./libs", verbose=TRUE)
Error in library("test_pkg1", lib.loc = "./libs", verbose = TRUE) :
‘test_pkg1’ is not a valid installed package
Notice, the message is not, there is no package called
, the package is detected, but seems, how is not built, I can't load it from library
. I try build the package, but don't works either.
Try devtools::dev_mode(on = NULL, path = "libs")
Sadly, this method seems to have the same behavior as the .libsPath
method.