building r packages
play

Building R packages Sren Hjsgaard Department of Mathematical - PowerPoint PPT Presentation

Building R packages Sren Hjsgaard Department of Mathematical Sciences Aalborg University, Denmark September 24, 2012 Printed: September 24, 2012 File: package-slides.tex 2 Contents 1 Why build R packages 3 2 Getting started 4 3


  1. Building R packages Søren Højsgaard Department of Mathematical Sciences Aalborg University, Denmark September 24, 2012 Printed: September 24, 2012 File: package-slides.tex

  2. 2 Contents 1 Why build R packages 3 2 Getting started 4 3 EXERCISES: Writing R packages 5

  3. 3 1 Why build R packages To have R –work made publically available on CRAN http://cran.r-project.org/ are, the work must be put into an R package. Another reason for creating an R package is that it is a simple way of organizing your own work – and of sharing work among collaborators. Windows users must download and install Rtools from http://cran.r-project.org/ . For linux users, no particular steps are necessary. For Mac users, I do not know.

  4. 4 2 Getting started A skeleton of a package called ASC can be created with R> package.skeleton("ASC") The ASC directory contains an R directory (where R functions are put) and a man directory (where documentation files are put).

  5. 5 To install the package, do R CMD INSTALL ASC To build the package (create a tar–ball which can be distributed), do R CMD build ASC To create a zip file (the easiest way to install a package on windows) do R CMD INSTALL --build ASC To check that the package meets the requirements of CRAN to R CMD check ASC Then there are many additional bells and whistles that can be added. See“Writing R Extensions”for details: http://cran.r-project.org/doc/manuals/R-exts.html

  6. 6 3 EXERCISES: Writing R packages 1. Create a template for a package called ASC . Make sure that you can compile and install the package. 2. Put the R functions you have created so far in the course into the package. Create documentation files for your functions. (Hint: prompt() is your friend). Create documentation files for your datasets. (Hint: promptData() is your friend).

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend