On 4 December 2015 at 14:01, Thomas Lin Pedersen wrote:
| > On 04 Dec 2015, at 13:16, Dirk Eddelbuettel <e...@debian.org> wrote:
| > On 4 December 2015 at 12:31, Thomas Lin Pedersen wrote:
| > | Any package residing in usr/local/lib/R/library will be loaded into the
| > | environment fine, while any package in /home/ubuntu/R-libs will throw the
| > | error.
| > 
| > So maybe don't install into /home/ubuntu/R-libs ?
| > 
| > There are no hardcoded path in Rcpp. This strikes me as a run-time config
| > (and hence not an Rcpp question for this list).
| > 
| > Dirk
| > 
| 
| Ok - (slight embarrassment to follow) I looked at the Environment constructor 
and found that it basically just called as.environment, which led my to try 
this out in R. This also failed, but for the reason that the requested package 
was only loaded, not attached (It’s part of the Import field of my package). 
calling library() to attach the package solved the issue…
| 
| The obvious follow up question is: Is there no way to use R functions from 
Rcpp if they are not part of the users search path (but part of the package 
namespace). I generally tend to avoid putting packages in Depends in order to 
not pollute the users search path.

Join the r-package-devel list and discuss there.  This is now an R discussion
beyond Rcpp because Rcpp just talks the R session it was called from.

As for current best practices: use Import: with appropriate global (or better
still if you can) per-symbol importFrom(package, funA, funB, funC) in NAMESPACE.

That gets you the symbols and leaves your search path alone. You do not need
a package as the mechanism for this just as you do for Depends:.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to