I\'m trying to port some packages to an R installation on an offline (Windows) computer.
From CRAN (let\'s say data.table), the process: 1) download .zip
So I've finally come up with a workaround that works in some cases... but it's admittedly a bit macgyvered. Would love to hear some feedback about how to make this approach work for any package.
Since I have a package where all of the code is in one .R file, I spoofed a package environment for that package and sourced the functions into that environment. Suppose the package is all in test.R:
#add an appropriately named package to the search() path
attach(environment(), name = "package:pkg")
#source the functions
sys.source("test.R", envir = as.environment("package:pkg"))
Voila. I don't know enough about how packages are loaded to say how to do this, for example, if the package has src code in C or something else.