Does packrat set the search path automatically?

45 views
Skip to first unread message

lars verspohl

unread,
Apr 18, 2018, 8:11:46 AM4/18/18
to packrat-discuss
This might be a relatively simple question. When using Packrat without RStudio, does it set the search path automatically or do I need to manually set it?

I reproduce a Packrat project (no .Rproj file) from within the respective working-directory with: packrat::restore() followed by packrat::init().

After initialization of a restored project I would assume Packrat sets my search path automatically. However, my only search path points to the System Lib:

> .libPaths()
[1] "/Library/Frameworks/R.framework/Versions/3.4/Resources/library"

Do I need to change it manually with .libPaths(packrat::lib_dir()) or is there a different solution? Feels like I'm missing a piece...

Many thanks! lars 

Kevin Ushey

unread,
May 11, 2018, 2:52:48 PM5/11/18
to lars verspohl, packrat-discuss
Sorry for the late response!

Packrat does attempt to update the library paths when the R session is launched. This is done through a generated .Rprofile file, which in turn sources a file 'packrat/init.R' which does this startup. Is it possible the .Rprofile was not re-generated in your case, for some reason?

Also, just to be sure -- was the R session launched from the root directory of the project?

Thanks,
Kevin

--
You received this message because you are subscribed to the Google Groups "packrat-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packrat-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages