R Packages

Resources

R-NIX R package

R gets shipped with LabKey as a default statistical tool. R provides tutorial on building packages, and rNIX is a package that implements standard functions used in R scripts within NIX environment.

Usage

If you believe a routine from rNIX would help your code, add the following lines to LabKey R-scripts:

.libPaths('/home/labkey/R/site-library')
library(devtools)
install_git('https://git0.fmf.uni-lj.si/studen/rNIX')
library(rNIX)

Development

If you want to add functions to rNIX, clone the git repository to a folder of your choice (we call it /path from now on). Follow steps from package documentation, particularly:

  1. section 1.6: add code to an R file of your choice, edit R/file.R where edit is your favorite editor and file.R is a file of your choice. If you think your function fits one of the files already in repository, you can append the file in question.
  2. chapter 10: check and list dependencies
  3. section 1.12: add documentation on function
  4. section 1.10: add yourself as author in DESCRIPTION
  5. section 1.12: run document('/path') where path is the location where rNIX was cloned
  6. section 1.9: run check('/path'). Typically, a note on failed sync is printed, but other errors or warnings should be cleared prior to further steps by repeating steps from above.
  7. section 1.14: run install('/path'). There are rarely problems here if previous steps were OK.
  8. section 1.8.1: commit changes and push them to git0. On top of R file, there is a file with the name of the function in man directory, and often, DESCRIPTION changes as well. See what to commit by running git status. The last step requires write permission to rNIX repository, contact andrej.studen@fmf.uni-lj.si to grant permissions.

Discussion