Like virtualenv and requirements.txt in python based projects, I want to package R dependencies like RPostgreSQL, rJava, xlsx etc. and re-install them on another machine through automation.
I tried using packrat on my mac:
packrat::init()
install.packages("RPostgreSQL")
packrat::snapshot()
packrat::bundle()
When I try to unbundle() into a different folder, it gives below error:
Rscript -e "packrat::unbundle('folder1/packrat/bundles/anyname-2019-01-06.tar.gz', './', 'TRUE')"
- Untarring 'anyname-2019-01-06.tar.gz' in directory 'folder2'...
- Restoring project library...
Error: This project does not have a lockfile. (Have you called 'packrat::snapshot()' yet?)
Execution halted
Please suggest a step by step guide how to package R dependencies from one machine and reproduce them on different machine and later execute R scripts through bash.