You are here: Vanderbilt Biostatistics Wiki>Main Web>StatComp>RS>RConfiguration (revision 30)EditAttach

Configuring R

Using html Help Facility

Linux users of R version 2.10 and later may want to take advantage of the new dynamic html rendering of help pages. The konqueror browser under KDE is efficient to use for this purpose, and can be told to open new help windows as new tabs on the existing konqueror invocation. That way you can switch back and forth between help pages for different functions. To set this up with the konqueror browser, put the following lines in your ~/.Rprofile file: options(help_type='html', browser='chromium-browser')

Other R Profile Options

To use the chromium-browser (sudo apt-get install chromium-browser) and to specify a nearby CRAN repository and take control of where downloaded packages are installed, put the following in ~/.Rprofile options(help_type='html', browser='chromium-browser', repos='http://cran.opensourceresources.org', lib='/usr/local/lib/R/site-library') Note that the lib option does not always take, and certain things you run in R can redefine the library path. To be certain of where packages are installed, do something like install.packages(...., repos='http://cran.opensourceresources.org', lib='/usr/local/lib/R/site-library') You may want to put the following code in ~/.Rprofile so that you can install one or more packages using e.g. installPac(c('rms','quantreg')) and likewise so it's easy to update all packages using updatePac() installPac <- function(p) install.packages(p, repos='http://cran.case.edu', lib='/usr/local/lib/R/site-library') updatePac <- function(checkBuilt=FALSE, ...) update.packages(repos='http://cran.case.edu', instlib='/usr/local/lib/R/site-library', checkBuilt=checkBuilt, ...)

Using RStudio

If you run R through RStudio put the following line in ~/.bashrc so you can invoke it from the command rstudio alias rstudio="/usr/lib/rstudio/bin/rdesktop"

Setup for knitr

See KnitrHowto for commands to put in ~/.Rprofile to make it easy to get publication-quality knitr output.

Here's an example .Rprofile - save it to your home directory (in Windows 7 this is your Documents directory if at the Windows command prompt, i.e., c:\Users\yourname\Documents, otherwise in Explorer this is your home directory My Documents) as ".Rprofile" (the dot "." is required). Or run the following: setwd('~/') download.file('http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RConfiguration/Rprofile', '.Rprofile')

Setup for Windows users for wget

Note: The version of of getRs in .Rprofile posted 2015-04-21 does not need wget.

To use R functions to fetch from https as opposed to http it is convenient to use method='wget' (in download.file, url.show, etc.). To do this you must have wget installed. Go here. Right click on wget.exe and save it in your normal Downloads area. Open Windows Explorer, go to Downloads, right click and hit Copy. Go to Computer ... OS (C:) ... Windows ... System32, right click, hit Paste. Approve the use of administrator privileges, then save wget.exe in System32. This will put wget.exe in the system path for use with R.

Setup wget for Macintosh OSX users

Mac OS X 10.10 Yosemite does not come with the command line utility wget installed. The web site http://coolestguidesontheplanet.com/install-and-configure-wget-on-os-x/ contains instructions for installing wget. These instructions are for Yosemite, but should work for other recent versions of OS X.

A more manual process is documented at http://coolestguidesontheplanet.com/install-and-configure-wget-on-os-x/.

Topic attachments
I Attachment ActionSorted ascending Size Date Who Comment
RprofileEXT Rprofile manage 8.9 K 21 Apr 2015 - 15:02 FrankHarrell example Rprofile
graphicsSet.rr graphicsSet.r manage 7.0 K 07 Apr 2015 - 16:17 FrankHarrell Graphics defaults setup
Edit | Attach | Print version | History: r32 | r31 < r30 < r29 < r28 | Backlinks | View wiki text | Edit WikiText | More topic actions...
Topic revision: r30 - 21 Apr 2015, FrankHarrell
 

This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback