Skip to content

Instantly share code, notes, and snippets.

@milktrader
Created June 30, 2012 14:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milktrader/3024051 to your computer and use it in GitHub Desktop.
Save milktrader/3024051 to your computer and use it in GitHub Desktop.
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* package ‘qux’ ...
** R
** preparing package for lazy loading
** help
No man pages found in package ‘qux’
*** 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