A personalized setup for R
. I've found it useful to add
library(setup)
to my .Rprofile
, maybe others will too. Always
changing, never any goals for stabilization.
library("setup", quietly = TRUE, warn.conflicts = FALSE)
The guiding principle of the setup
package is to include
functionality that is intended exclusively for interative sessions
and not in scripts or packages that are intended for other users.
The recommended way to use setup
is to
fork it and modify as
desired for your needs in interactive sessions.
- utilities
for processing parts of
knitr
chunks - tools for checking your progress on git projects
- extract package info for makefiles
- alternative interface
to
R
's symbolic differentiation tools - sugar for random matrices
- sugar for using uniform distributions over subsets of the integers
- sugar
for interfacing with
bash
- yes i really want to quit!
Quick random matrices!
rmat(5, 3)
## [,1] [,2] [,3]
## [1,] -0.66632144 1.3042986 0.1259268
## [2,] -0.75127404 -1.2725709 -0.1596205
## [3,] -0.46391447 -1.1113941 -1.3869535
## [4,] 0.07424689 0.8562972 1.4712344
## [5,] -0.47383856 -2.0638588 0.4354084
Symbolic differentiation without expressions!
gradient("(x^2)/y", c("x", "y"))
## gradient
## x 2 * x/y
## y -((x^2)/y^2)
hessian("(x^2)/y", c("x", "y"))
## x y
## x 2/y -(2 * x/y^2)
## y -(2 * x/y^2) (x^2) * (2 * y)/(y^2)^2
Using
tarName
in a makefile.
PKG = lme4
TAR = $(shell Rscript -e "tarName(\"$(PKG)\")")
BUILD = R CMD build --no-build-vignettes
INSTALL = R CMD install
CHECK = R CMD check
all: $(TAR) install
$(TAR):
$(BUILD) $(PKG)
install: $(TAR)
$(INSTALL) $(TAR)
check: $(TAR)
$(CHECK) $(TAR)