12.07.2015 Views

R dummies

R dummies

R dummies

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

a number of startup options by adapting the Rprofile.site file. This file is locatedinside the installation directory, in the subfolder …/R-n.n.n/etc (for example, …/R-2.14.1/etc). The file is sourced by R at startup, so all R code in this file is carriedout. The default installation of R contains a perfectly valid Rprofile.site file, soyou have to change this only if you want to personalize your startup.Rprofile.site is a normal text file, so you can edit it as you would any othertext file. The file already contains some options that are commented out, so youget a good idea of what’s possible when you open the file in a text editor (such asNotepad). Be sure to check the Help page ?options to get more information on allpossible options.You can personalize R further by adding a code file called .Rprofile to yourpersonal home folder. You can find this folder from within R by setting the workingdirectory to “~/”, like this:> setwd(“~/”)> getwd()[1] “C:/Users/Joris FA Meys/DocumentsAdding an .Rprofile file isn’t necessary, but R will always look for one, eitherin the folder from which you call R or in the user’s home directory. Whereas anRprofile.site file is linked to a specific installation of R, the .Rprofile file candiffer for every user on the same system. If you update R, you can leave the.Rprofile file where it is and the new R version will automatically find it and applythe options you specified there. So, after updating R to the latest version, you haveto adapt the Rprofile.site again only if you want to personalize it.Functions you define or objects you create with code in Rprofile.site won’tbe visible if you use ls(), although you can use them without trouble. Thisalso means you can’t delete them easily from the workspace.An Rprofile.site or .Rprofile file may look like the following example:# Sample profile file# Set CRAN mirror to a default locationoptions(repos = “http://cran.uk.r-project.org”)# R interactive promptoptions(prompt=”R: “)# sets work directory back to originalgo.home

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!