Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create R package from commandline prompts
[~]
R --silent
> boo = function(x) x*8
> boo(33)
[1] 264
> package.skeleton('boo', name='qux')
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './qux/Read-and-delete-me'.
> q()
Save workspace image? [y/n/c]: n
[~]
cd qux/
[qux]
ls
DESCRIPTION NAMESPACE R Read-and-delete-me man
[qux]
rm Read-and-delete-me
[qux]
rm -rf man/
[qux]
ls
DESCRIPTION NAMESPACE R
[qux]
..
[~]
R CMD INSTALL qux/
* installing to library/Library/Frameworks/R.framework/Versions/2.15/Resources/library
* installing *source* packagequx...
** R
** preparing package for lazy loading
** help
No man pages found in packagequx
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x86_64
* DONE (qux)
[~]
R --silent
> require(qux)
Loading required package: qux
> ls()
character(0)
> boo(7)
[1] 56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment