Loading...
 

Image

R

R here stands for the R statistics and programming language: http://www.r-project.org. You can find some useful information and links about R below.


1. Installing the software

1.1. Installing R

You can install R for GNU/Linux, Mac OSX or Windows from here:
http://cran.r-project.org

You can also see some videos about it, on Image Mac OSX and on Image Windows

1.2. Installing R commander

You can install R commander following these generic guidelines from the following pdf, plus some specific comments below for certain environments:

1.2.1. Generic instructions for GNU/Linux, Mac OSX and Windows:

See


Specific extra notes and tips, for each operating system:

1.2.2. For GNU/Linux:

You can use the extra repository RRutter to get the latest versions of R. See details here:

https://launchpad.net/~marutter/+archive/ubuntu/rrutter

1.2.3. For Mac OSX:

  1. Allow installing programs from unidentified sources
    Recent versions of Mac OSX operating system (like 10.10, and similar) come pre-configured to disallow installing programs from external unidentified sources by the Mac App Store or Apple. Therefore, you need first to change the Mac OSX settings to also allow installing programs from unidentified sources:
    1. Go to System preferences > Security and Privacy
      Click to enlarge
      Click to enlarge
    2. Click at "Click here to perform changes" and authenticate with your password
      Click to enlarge
      Click to enlarge
    3. Select: "Allow applications downloaded from:" Any site, and click at the popup window to confirm your choice.
      Click to enlarge
      Click to enlarge
    4. Click at "Click here to perform changes"
      Click to enlarge
      Click to enlarge
  2. Install the extra software eventually required
    • In old versions of OSX and R, you had to install R plus tcl/tk separatedly for Rcommander to work, but in recent versions (R 3.1.2 and OSX 10.6), tcl/tk comes included already in the default R installation package.
      Fes clic per ampliar
      Fes clic per ampliar
    • Once you have R installed in your system, you can install R commander as usual in an R console ( install.packages("Rcmdr") ), and then, you can load the library to have the program open for you: ( library("Rcmdr") ). If it's the first time you install it, it will indicate that you need to install some extra R packages and XCode. Click at the corresponding buttons (for instance, first at the R packages installation):
      Fes clic per ampliar
      Fes clic per ampliar
    • Proceed to install the required R packages first, in the next screen that you will see:
      Fes clic per ampliar
      Fes clic per ampliar
    • And then, when done, you can continue installing XCode:
      Fes clic per ampliar
      Fes clic per ampliar
    • In case that you don't have the system libraries XQuartz updated, you will need to install or update them if indicated by the R or R commander installer at any time. Go to their webpage to download the corresponding package and install it:
      http://xquartz.macosforge.org/
      Click to enlarge
      Click to enlarge


Did you get any message about "Missing xcrun"?

1.2.4. For MS Windows:

  • Install R, and run the program.
  • Install Rcmdr throgh the R console as usual, with the instruction install.packages("Rcmdr")
  • Then, you can load the library to have the program open for you ( library("Rcmdr") ).
    If it's the first time you install it, it will indicate that you need to install some extra R packages. Click at the corresponding button to have them installed for you, and R Cmmander will be launched automatically afterwards.

1.3. Installing R Studio

You can install RStudio (a multiplatform Graphical User Interface with many addons pre-installed) from here:
http://www.rstudio.com/products/rstudio/download/

2. Configuration behind a Proxy?

Are you running R in a computer behind a Firewall (Proxy)? In such case you need to indicate R which is the proxy address and port to reach internet (the door to get out of the wall). This is the case, for instance, of the Vall d'Hebron Research Institute (VHIR), and a many other institutions worldwide. In such case, read below how to set up the proxy configuration for R.

If you move the laptop elsewhere outside of the VHiR network, remember to disable the proxy related settings in the edited files, yf any, and the network settings for your operating system.

2.1. Inside R scripts

You can use the Sys.setenv variable temporarily in your R session:

Sys.setenv(http_proxy="http://username:password@proxy.com:port")


For VHIR, use this line:

Sys.setenv(http_proxy="http://conf_www.ir.vhebron.net:8080")



For packages like RCurl, you can use:

options(RCurlOptions = list(proxy="proxyhost", proxyuserpwd="user:pass"))

2.2. In GNU/Linux

To add the proxy information system wide for all your users in your computer/server, you can edit the file

  • /usr/lib/R/etc/Renviron (in Ubuntu 14.04, symlinked from /etc/R/Renviron )
    or in equivalent locations in other distributions and R versions: /usr/lib64/R-XXX/etc/, /usr/lib64/R/etc/, /usr/local/lib64, /R-XXX/etc/)


and use the usual syntax to indicate a proxy address:

http_proxy="http://username:password@proxy.com:port"


In the case of VHIR, you can add the following lines towards the end of the file:

HTTP_PROXY="http://conf_www.ir.vhebron.net:8080"
http_proxy="http://conf_www.ir.vhebron.net:8080"
ftp_proxy="http://conf_www.ir.vhebron.net:8080"


2.3. In Mac OSX

You can use

http_proxy="http://un:pw@proxy.com:port"


in your ~/.Renviron file

To do so, launch a terminal or X11 window in your MacOSX applications or utilities menu, and type:

nano ~/.Renviron


And paste inside this content:

HTTP_PROXY="http://conf_www.ir.vhebron.net:8080"
http_proxy="http://conf_www.ir.vhebron.net:8080"
ftp_proxy="http://conf_www.ir.vhebron.net:8080"

2.4. In Windows

You can tweak the direct access icon to launch R, as follows:

Target path:

"C:\Archivos de programa\R\R-3.1.2\bin\i386\Rgui.exe" --internet2


Image

This assumes that you have the proxy configuration already set beforehand in your computer at the network configuration settings.

3. Help documents


4. Learning Statistics using R through UEB courses

You can learn statistics using R and R-Commander by means of attending at one of the courses that the 'Statistics and Bioinformatics Unit' (UEB) holds at Vall d'Hebron Research Institute (VHIR):

2016:



5. Using R in the UEB Server

In case you want to use R in the UEB Server, you can do so following the instructions indicated below.

5.1.1. Book a period for the usage of R in the UEB Server

The server where R is offered to VHIR researchers can also run other softwares on demand. In order to prevent the server from running out of CPU or RAM resources for your project, we advise you to book in advance at the UEB Booking system, and choose (if possible) time frames where no other booking for R or Partek are scheduled.

Therefore, you can book your prefered dates in the booking system at the UEB website (selecting "Partek_or_R_at_UEB_Server"):

http://ueb.vhir.org/bookings/index.php?room=2

Close
tipNew to the UEB booking system?
If you have never used the UEB booking system before, contact us.

5.1.2. Connect to the UEB B52 Server


See the instructions on how to use the External access to the UEB B52 Server.

5.1.3. Use the program in the UEB B52 Server


In order to use "R" in the UEB B52 Server, you can:

  1. Use it from the command line:
    1. open a terminal window, by clicking at the icon "terminal"
    2. type R and press intro.
      R
    3. Use the program normally.
      • You can launch also the Rcommander if you wish.
      • You save your Data in the folder /home/vhir/Usuaris/your_username/

      or
  2. Use RStudio, a simple yet powerful Graphical User Interface for R (http://rstudio.org)
    • You have an icon at the top bar of the desktop for RStudio.
      Image

5.1.4. Transfer results from and to your local machine


See the corresponding section at the page with information for External access to the UEB B52 Server.

Any issues?


Contact us at ueb(a)vhir.org or +34 934894007 if you have any issues connecting.