Loading...
 

Configuració d'R i associats a Ubuntu


1.1. Afegir repositori R 3.0 a Ubuntu (rRutteR)

Si no tenim tot l'R 3.x instal·lat encara, afegir aquest repositori. Si ja tens una versió prèvia de R 3.x instal.lada, pots anar directament a l'apartat 1.2 i fer el sudo "apt-get update" i desde consola de R "update.packages(ask = F, checkBuilt = T)")

sudo su
add-apt-repository -y ppa:marutter/rrutter # Needed for updated R 3.x
add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable # Needed for tmap
add-apt-repository -y ppa:opencpu/jq # Needed for tmap
apt-get update -q
exit


https://launchpad.net/~marutter/+archive/rrutter?field.series_filter=xenial

1.1.1. Actualitzar la llista de paquets i l'R

Ara ja podem fer actualitzar la llista de paquets i actualitzar R:

sudo apt-get install r-base r-recommended


Users who need to compile R packages from source e.g. package maintainers, or anyone installing packages with install.packages() should also install the r-base-dev package:

sudo apt-get install r-base-dev


O via Synaptic Package Manager cercant la versió desitjada d'R-base..., marcant per instal·lar i clicant Apply

Si vols instal·lar els paquets complementaris de R per a tot l'ordinador (instala·lació de sistema), cal que donis permisos a la carpeta que s'empra per omissió /usr/lib/R/site-library, per exemple executant això en una consola:

sudo chmod 777 /usr/lib/R/site-library
sudo chmod 777 /usr/lib/R/library


I si ja tens paquets instal·lats, i se't queixa R de que no pot actualitzar-los, cal que canviïs els permisos dels paquets ja instal·lats en aquestes dues carpetes, i la de la documentació en html ( /usr/share/R/doc/html/ ). Pots fer les dues coses (canviar permisos de la carpeta mare, els seus arxius i de les carpetes filles de forma recurrent amb:

sudo chmod 777 /usr/lib/R/site-library /usr/lib/R/site-library/* -R
sudo chmod 777 /usr/lib/R/library /usr/lib/R/library/* -R
sudo chmod 777 /usr/share/R/doc/html/* -R


If using Ubuntu-mate, you seem to need to change perms on this folder also:

sudo chmod 777 /usr/local/lib/R/site-library /usr/local/lib/R/site-library/* -R


If using RRO, you have to change permissions here instead:

sudo chmod 777 /usr/lib64/RRO-8.0.3/R-3.1.3/lib/R/library /usr/lib64/RRO-8.0.3/R-3.1.3/lib/R/library/* -R
sudo chmod 777 /usr/lib64/RRO-8.0.3/R-3.1.3/lib/R/doc/html /usr/lib64/RRO-8.0.3/R-3.1.3/lib/R/doc/html/* -R


Alternativament, R et demanarà de crear una carpeta personal on deixar els paquets que instal·laran per al teu usuari, tot i que més endavant, és molt possible que se't queixi igualment que algun paquet de sistema no el pot actualitzar perque no té prous permisos per fer-ho, etc. Així que potser millor donar permisos d'una vegada a que es puguin instal·lar o actualitzar els paquets d'R del sistema, amb les instruccions anteriors.

Per actualitzar els paquets d'R que no són a repositoris d'Ubuntu, cal obrir R i actualitzar paquets associats des de dins de la consola d'R:

update.packages(ask = F)


Si s'ha instal·lat algun paquet a la carpeta de paquets d'R de l'usuari, i es vol actualitzar el mateix paquet antic que hi ha a la carpeta del sistema, cal indicar-ho explicitament amb la instrucció:

update.packages(ask = F, lib="/usr/lib/R/site-library")

1.2. Install usual R packages

Usual R packages that are useful in many cases in the Bioinformatics world. You can install them in an R console in a terminal (Type "R" in the terminal to launch the R console), or through RStudio command line.

Run in an R console
install.packages(c("devtools", "plotly", "Nozzle.R1", "VennDiagram", "stringr", "xml2", "data.table", "doParallel", "xtable", "plyr", "dplyr", "reshape2", "rjson", "d3heatmap", "htmlwidgets", "googleVis", "doMC", "knitr", "checkpoint", "XLConnect", "sem", "rmarkdown", "relimp", "effects", "aplpack", "flexdashboards", "addinslist", "tidyverse", "magick", "webshot", "pacman", "officer", "flextable", "huxtable"))
install.packages(c("Rcmdr", "RcmdrPlugin.survival", "RcmdrPlugin.HH", "RcmdrPlugin.EZR", "RcmdrPlugin.EBM", "RcmdrPlugin.sampling", "RcmdrPlugin.KMggplot", "RcmdrPlugin.ROC"))
library(devtools);if(!require(rCharts)) install_github('rCharts', 'ramnathv')
source("https://bioconductor.org/biocLite.R")
biocLite(c("affylmGUI", "pd.mogene.1.0.st.v1", "oligo", "limma", "Biobase", "arrayQualityMetrics", "genefilter", "org.Mm.eg.db", "multtest", "annotate", "xtable", "GOstats", "gplots", "scatterplot3d", "VennDiagram", "edgeR", "pathview", "gage", "gageData","GenomicAlignments","TxDb.Hsapiens.UCSC.hg19.knownGene", "systemPipeR"))

1.3. Instal·lar BioConductor

1.3.1. Via bioCLite

Open the R console, and type inside:

source("http://bioconductor.org/biocLite.R")
biocLite()

1.3.2. Instal·lar paquets bàsics de BioConductor (via Debian Med Ubuntu repository)

Alternativament, sembla que hi ha un repositori de paquets de biomedicina i bioinformàtica anomenat Debian Med, que té alguns paquets .deb de paquets de Bioconductor, per a algunes versions d'Ubuntu (no totes). El total de paquets és:

  • r-bioc-biobase
  • r-bioc-cummerbund
  • r-bioc-edger
  • r-bioc-limma


A part, hi ha altres versions de paquets útils (bwa, bowtie, etc). De totes formes, sembla que a 12.04 no hi ha paquets actualitzats de Debian-Med. En qualsevol cas, si es vol afegir, aquestes són les dues línies a afegir a /etc/apt/sources.list (canviar precise per la distro d'ubuntu)

sudo su
add-apt-repository ppa:debian-med/ppa
apt-get update
apt-get install bamtools bambamc bwa 
exit

1.3.3. Instal·lar paquets NO bàsics de BioConductor (via Debian Med Ubuntu repository)

Mirar secció 5 d'aquesta mateixa pàgina

1.4. Instal·lar tots els paquets d'anotacions d'organisme

List available at:
http://bioconductor.org/packages/release/data/annotation/

Open the R console, and type inside:

Command on an R console
source("http://bioconductor.org/biocLite.R")
biocLite(c("org.Ag.eg.db", "org.At.tair.db", "org.Bt.eg.db", "org.Ce.eg.db", "org.Cf.eg.db", "org.Dm.eg.db", "org.Dr.eg.db", "org.EcK12.eg.db", "org.EcSakai.eg.db", "org.Gg.eg.db", "org.Hs.eg.db", "org.Hs.ipi.db", "org.Mm.eg.db", "org.Mmu.eg.db", "org.Pf.plasmo.db", "org.Pt.eg.db", "org.Rn.eg.db", "org.Sc.sgd.db", "org.Sco.eg.db", "org.Ss.eg.db", "org.Xl.eg.db"))


This is useful, for instance, to use the goProfiles package.

Other usually needed annotation db packages for our pipeline include installing these oher (big) packages:

Command on an R console
source("http://bioconductor.org/biocLite.R")
biocLite(c("pd.hta.2.0", "hta20stprobeset.db", "hta20sttranscriptcluster.db")) # For HTA microarrays pipeline
biocLite(c("ade4", "affy", "annotate", "Biobase", "biomaRt", "Biostrings", "BSgenome", "bumphunter", "Cairo", "calibrate", "CNVassoc", "compareGroups", "data.table", "cqn", "DEoptimR", "DESeq", "DESeq2", "DMRcate", "DNAcopy", "doParallel", "doRNG", "edgeR", "epiR", "epitools", "FactoMineR", "ff", "flexclust", "flexmix", "foreach", "foreign", "formatR", "genetics", "GenomeGraphs", "GenomicFeatures", "GenomicRanges", "GEOquery", "glmmML", "GO.db", "GOstats", "gplots", "grid", "gridExtra", "GSEABase", "gtable", "gtool", "GWASTools", "hgu95av2.db", "hgu95av2cdf", "hgu133a.db", "iClusterPlus", "IlluminaHumanMethylation450k.db", "IlluminaHumanMethylation450kanno.ilmn12.hg19", "IlluminaHumanMethylation450kmanifest", "illuminaio", "IRanges", "limma", "lubridate", "maps", "matrixStats", "mclust", "methylumi", "omicade4", "org.Hs.eg.db", "org.Mm.eg.db", "org.Sc.sgd.db", "parallel", "Rsamtools", "rngtools", "RCurl", "Rcpp", "S4Vectors", "SNPassoc", "snpStats", "stringr", "survival", "sva", "tweeDEseq", "tweeDEseqCountData", "TxDb.Hsapiens.UCSC.hg18.knownGene", "TxDb.Scerevisiae.UCSC.sacCer3.sgdGene", "vegan", "wateRmelon", "wordcloud", "XML", "zoo", "RnBeads", "pathview", "Rsubread", "tweeDEseqCountData", "tweeDEseq", "cqn", "edgeR", "DESeq", "DESeq2", "DeconRNASeq", "GEOquery", "oligo", "rgcca", "srgcca"))  # for RNA-seq pipeline

1.5. Actualitzar paquets de BioConductor (update.packages)

That is needed, for insatance, once you upgrade to a new version of R (from 2.13 to 2.14, for instance).

Open the R console, and type inside:

source("http://bioconductor.org/biocLite.R")
update.packages(repos=biocinstallRepos(), ask=FALSE, checkBuilt=TRUE)


If you have some issues related to some packages (such as cairoDevice) not installing because they can't be tested (due to missing some X11 programs or others), try this other command, which prevents from attempting to test the installation of the remaining packages to install:

source("http://bioconductor.org/biocLite.R")
update.packages(repos=biocinstallRepos(), ask=FALSE, checkBuilt=TRUE, INSTALL_opts="--no-test-load")



In recent Bioconductors (at least as of 2013), you can also use:

source("http://bioconductor.org/biocLite.R")
biocLite("BiocUpgrade")



(Ricardo) Jo per aconseguir instal·lar el "affycoretools" ho he hagut de fer així:

source("http://bioconductor.org/biocLite.R")
biocLite("affycoretools")


Alternatively, here you have some other tips (from Bioconductor email list):

Hi John,

On 11/8/2011 9:33 AM, John Coulthard wrote:
Hi

I'm trying to install Rsamtools and getting errors! I've tried...
install.packages("/home/ann/downloads/Rsamtools_1.6.0.tar.gz")
and
biocLite("Rsamtools")
(see below)


Why doesn't biocLite() install the current version?
I'm almost sure the dependencies are all up-to-date using install.packages().
So if it's not an out of date dependent what could the problem be?
If is it an out of date dependent how do I get R to tell me which one?

You appear to be going rogue here. You should not be using install.packages() at all, and should not be using an outdated version of biocLite().

You want

source("http://www.bioconductor.org/biocLite.R")

which will install the BiocInstaller package (and load it for you this time)

then in future, you should

library(BiocInstaller)
biocLite("Rsamtools")

which will

biocLite("Rsamtools")
BioC_mirror: 'http://www.bioconductor.org'
Using R version 2.14, BiocInstaller version 1.2.0.
Installing package(s) 'Rsamtools'

trying URL 'http://www.bioconductor.org/packages/2.9/bioc/src/contrib/Rsamtools_1.6.0.tar.gz'
Content type 'application/x-gzip' length 2088510 bytes (2.0 Mb)


Note the message I get compared to what you got.

Best,

Jim

1.6. Llibreries GNU/Linux necessàries per a instal·lar alguns paquets de R i Bioconductor


Copiar i enganxar aquesta comanda a un terminal:

Command on a console (Ubuntu 10.04 i 11.04)
sudo apt-get install r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz4 libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev libgtk2.0-dev

Command on a console (Ubuntu 11.10)
sudo apt-get install r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz4 libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev r-cran-rglpk libgtk2.0-dev

Command on a console (Ubuntu 12.04)
sudo apt-get install r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz-dev libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev r-cran-rglpk libgtk2.0-dev  libnetcdf-dev netcdf-bin netcdf-doc

Command on a console (Ubuntu 14.04)
sudo apt-get install r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz-dev libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev r-cran-rglpk libgtk2.0-dev libglpk-dev libnetcdf-dev netcdf-bin netcdf-doc bwidget tk-table libv8-dev r-cran-rjava libmpfr-dev libc6-i386 libssl-dev r-cran-plyr r-cran-rmysql openjdk-7-jdk openjdk-7-jre-*

Command on a console (Ubuntu 16.04)
sudo apt-get install -y  r-recommended  r-cran-xml libgraphviz-dev libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev r-cran-rglpk r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz-dev libcairo2-dev bwidget tk-table libv8-dev r-cran-rjava libmpfr-dev libc6 libssl-dev texlive-latex-extra texlive-lang-spanish libx11-dev libxml2-dev libxml2:i386 libxt-dev r-cran-misc3d subversion git texmaker tk-dev unaccent xvfb libgdal1-dev libproj-dev r-cran-rmysql libmagick++-dev r-cran-rcolorbrewer r-cran-doparallel libssh2-1-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev libv8-dev libjq-dev libprotobuf-dev protobuf-compiler libssl-dev libcairo2-dev

Paquet en R
Paquet en Fedora / Red Hat
Paquet en Debian / Ubuntu
Comentaris
rgl r-cran-rgl Llibreries de desenvolupament de software per X
r-cran-misc3d Miscelanea progs for rgl and 3d plots (on Ubuntu 11.04)
libX11-devel, libXt-devel libx11-dev, libxt-dev (OpenGl: freeglut3, freeglut3-dev)
Rglpk libglpk-dev r-cran-rglpk (on Ubuntu 14.04)
RCurl curl-devel libcurl3-dev
ó
libcurl4-gnutls-dev
Per processar algunes urls des de paquets d'R. En Actualitzar a R 2.14, vaig haver de re-instalar el paquet 'bitops' de bioconductor primer per tal que RCurl es pogués instal·lar bé (Xavi).
XML libxml2-dev libxml2-dev
r-cran-xml
Rgraphviz libgraphviz4
libgraphviz-dev
Té a veure amb la llibreria "graphviz" però no la he trobat a la Red Hat Network. Caldrà anar-la a cercar directament a altres repositoris. Jo no la tinc instal·lada (data 2008/06/05)
SNPassoc Instal·lat directament a R
MSnbase o ncdf libnetcdf-dev Instal·lar-lo via synaptic. Afegeix capçaleres netcdf.h
RNetCDF udunits-bin, libudunits2-dev Instal·lar-lo via synaptic. Afegir a l'anterior
GWASTools netcdf-bin
netcdf-doc
Instal·lar via synaptic, per a ncdf i GWASTools
cairo libcairo2-dev Instal·lar via gestor de paquets
r-cran-cairodevice Instal·lar via gestor de paquets
libxt-dev Instal·lar via gestor de paquets
libgtk2.0-dev Sembla que podria ser necessari per al cairoDevice en R 2.14+
Si tot i haver posat aquests paquets, es continua mostrant un prolema d'instal·lació, veure la "Nota sobre cairoDevice" de més avall.
affylmGUI bwidgets tk-table necessita tcl/tk, que necessita aquests paquets de sistema.
affycoretools libc6-i386 r-cran-rjava Sembla que necessita rjava també, i unes llibreries de 32 bits (que són a libc6-i386) per a que rJava funcioni.
RCmdr libv8-dev r-cran-rjava libmpfr-dev sembla que ho necessita el RCmdr, via els paquets d'R de dependènies "XLConnect" i "sem"
devtools libssl-dev seems to be needed by git2r, which is a dependency from devtools

 Nota sobre cairoDevice

Command on a console
> install.packages("cairoDevice")
(...)
installing to /usr/local/lib/R/site-library/cairoDevice/libs
** R
** demo
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'cairoDevice', details:
  call: fun(libname, pkgname)
  error: GDK display not found - please make sure X11 is running
Error: loading failed
Execution halted
ERROR: loading failed
* removing \u2018/usr/local/lib/R/site-library/cairoDevice\u2019
* restoring previous \u2018/usr/local/lib/R/site-library/cairoDevice\u2019

The downloaded packages are in
        \u2018/tmp/RtmpHrgbZK/downloaded_packages\u2019
Warning message:
In install.packages("cairoDevice") :
  installation of package \u2018cairoDevice\u2019 had non-zero exit status


You can solve this issue by passing a extra argument to install.packages in which you require R not to test the installation of cairo, since you are in a headless server with (eventually) some X11 libs (or *whatever*) missing.

Command on an R console to install cairoDevice sucessfully
install.packages("cairoDevice", INSTALL_opts="--no-test-load")


Instruccions sobre com trobar quin paquet de l'Ubuntu/Debian té les llibreries o paquets que li fan falta a l'R per poder instal·lar/compilar un paquet d'R:

gcc -I/usr/share/R/include      -fpic  -std=gnu99 -O3 -pipe  -g -c Hmisc.c -o 
Hmisc.o
In file included from /usr/include/bits/errno.h:25,
                 from /usr/include/errno.h:36,
                 from Hmisc.h:5,
                 from Hmisc.c:1:
/usr/include/linux/errno.h:4:23: error: asm/errno.h: No such file or directory


so the header file "asm/errno.h" cannot be found on your system, but is needed
to compile the Hmisc package sources. it's not a file from an R package, so
you can't fix it by installing other R packages. you need to find out which
ubuntu package provides it. run this on a console:

dpkg -S asm/errno.h


it will search for "asm/errno.h" in all available packages, and show you that
it's found in the package linux-libc-dev and linux header packages. once
you've installed what you need (e.g. "sudo aptitude install ",
i'd go for the linux-libc-dev package first), try the R installation again.

1.7. Java

Cm arreglar problemes relacionats amb rJava, java, libjvm.so, rJava.so, ...

Consulta la secció
http://ueb.vhir.org/Ubuntu+14.04+%28LTS%29+Trusty#Java

1.8. Altres llibreries GNU/Linux necessàries per a instal·lar altres paquets d'R

1.8.1. Thematic maps - tmap

# install fundamental spatial libraries (needed for sf, sp, rgdal, rgeos)
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev 

# install v8, needed for the R package V8 which reverse imports geojsonio and rmapshaper -> tmaptools -> tmap
sudo apt-get install libv8-3.14-dev

# install jq, needed for the R package jqr whith reverse imports: geojson -> geojsonio -> rmapshaper -> tmaptools -> tmap
sudo add-apt-repository -y ppa:opencpu/jq
sudo apt-get update -q
sudo apt-get install -y libjq-dev

# install libraries needed for the R package protolite, which reverse imports: geojson -> geojsonio -> rmapshaper -> tmaptools -> tmap
sudo apt-get install -y libprotobuf-dev protobuf-compiler

# other libraries
sudo apt-get install libssl-dev
sudo apt-get install libcairo2-dev

1.8.2. RMySQL

Per a instal·lar RMySQL, cal afegir aquests dos paquets:

A Ubuntu 10.04
sudo apt-get install libdbd-mysql libmysqlclient16-dev

A Ubuntu 12.04 i següents
sudo apt-get install libdbd-mysql libmysqlclient-dev r-cran-rmysql

1.8.3. Rgdal

Per a Bioconductor...
Per a instal·lar rgdal, per a bioconductor 2.11 (versió corresponent a R 2.15.2) pot ser necessari haver d'actualitzar el paquet gdal d'ubunu (Geospatial Data Abstraction Library) a una versió igual o superior a 1.7. Hi ha un repositori UbuntuGis stable que en té la versió 1.9.x per a Ubuntu Lucid 10.04:
https://launchpad.net/~ubuntugis/+archive/ppa

A part d'instal·lar la versió actualitzada llavors de gdal, cal eliminar (sembla) manualment el paquet libgdal1-1.6.0 i instal·lar el paquet libgdal1-1.8.0 i les dependències que correspongui.

Per a altres Mapes i GIS...
A Ubuntu 12.04...

sudo apt-get install libgdal1-dev libproj-dev


A Ubuntu 16.04

# Note: some system packages are needed for tmap to install properly in Ubuntu 16.04 systems
# and for some of them you may need to add an extra repository (confirmed upto Ubuntu 16.04)
sudo add-apt-repository -y ppa:opencpu/jq
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install libudunits2-0 libudunits2-dev libjq-dev libprotobuf-dev protobuf-compiler libgdal20


Package tmap (for Thematic Maps) in Ubuntu 16.04 seems to require the previous packages to be installed before attempting to install the tmap package in R.

1.9. Rstudio

Install rstudio (download version 0.99.878 or higher, which supports addins)

Add rstudio addins. Run this R code within the R terminal inside R Studio:

devtools::install_github("rstudio/addinexamples", type = "source") # ::


For more information, see:
http://rstudio.github.io/rstudioaddins/

1.10. Instal.lació de R conservant versions anteriors

1.10.1. Introducció

Aquest document pretén explicar com instal.lar en Linux noves versions de R, conservant les versions anteriors. Partirem de dues suposicions que no sempre han de ser certes, però ens faran simplificar el problema. La primera suposició (i la més important): el nostre sistema Linux té instal.lats tots els paquets necessaris per a que R i Bioconductor funcionin correctament (i compilin, si pot ser smile). Suposarem també, al menys de moment, que no hi ha cap versió anterior de R instal.lada, és a dir, que estem instal.lant R per primer cop (en cas de tenir-la, veure la secció Què fer si ja tenim un R instal.lat).

1.10.2. Consideracions prèvies

R en Linux acostuma a tenir una estructura de directoris bastant clara. Normalment, la instal.lació es fa en un directori de l'estil: <prefix>/<lib>/R, on <prefix> és un directori de l'estil “/usr” o “/usr/local”, i <lib> sol ser “lib64” (“lib” en el cas de Linux de 32-bits). A més, l'arxiu executable de R es sol trobar a <prefix>/bin. El problema ve quan volem instal.lar un altre paquest (.deb, .rpm, etc) amb una nova versió de R, perquè ens sobreescriurà els directoris existents de versions anteriors. Per evitar això, cal que anem un pas més enrera i compilem el codi font. És durant el procés d'instal.lació posterior a la compilació, on podrem especificar si volem un nom de directori diferent.

1.10.3. Compilació i instal.lació

Pasos a seguir:
  1. Hem de descarregar el “source code” de R-?.?.? de la pàgina web (R-?.?.?.tar.gz) a un directori diguem-li <downDir>.
  2. Hem d'obrir una consola, iniciar sessió com a root i anar al directori de descàrrega
    su -cd <downDir>)
  3. Hem de descomprimir i desempaquetar:
    tar xzf R-?.?.?.tar.gz
  4. El pas anterior ha creat un directori R-?.?.?, on hem d'entrar per a compilar i instal.lar.
    cd R-?.?.?
  5. El pas següent consisteix en compilar i crear els manuals:
    ./configure
    make
    make check 
    make pdf

    El make check es fa per a comprovar que tot ha anat bé
    • Si pel que sigui, el ./configure falla amb quelcom com:
      configure: error: --with-readline=yes (default) and headers/libs are not available
      com en el cas d'instal·lar un R 2.5.x (necessari per al software Gene Pattern a ma amb opcions per defecte), prova de cridar el configure indicant-li on són els includes i les llibreries de X11:
      ./configure --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib
  6. Ara cal fer la instal.lació (aquí és on indicarem el nou “rhome”)
    make install rhome=/usr/local/lib64/R-2.8.0
  7. Per últim, cal renombrar el fitxer executable R, que hauria d'estar a <prefix>/bin (en l'exemple anterior: /usr/local/bin)
    mv /usr/local/bin/R /usr/local/bin/R-2.8.0
Per fer que quan executem R en un terminal, s'ens obri l'R instal·lat des de repositoris (suposem que és la versió 2.13), i no pas l'R instal·lat des de SVN o per altres vies (per exemple, la 2.14), es poden executar aquest tipus d'instruccions en un terminal (adapta-ho al teu cas):
Command on a console
sudo mv /usr/local/bin/R /usr/local/bin/Rsvn 
sudo mv /usr/local/bin/Rscript /usr/local/bin/Rscriptsvn 
sudo ln -s /usr/bin/R /usr/local/bin/R
sudo ln -s /usr/bin/Rscript /usr/local/bin/Rscript
Un cop fet això, en executar R en un terminal, s'obrià el 2.13. I en executar Rsvn, s'obrirà el 2.14.

1.10.4. Què fer si ja tenim un R instal.lat

En cas de tenir una versió de R instal.lada, el procés anterior sobreescriuria el fitxer binari <prefix>/bin/R existent. Per tant caldria, abans de fer la instal.lació del nou R, renombrar aquest fitxer. Per exemple: mv /usr/bin/R /usr/bin/R-2.7.0, i després procedir a la instal.lació de R-2.8.0.

1.10.5. Consideracions finals

Aquest document s'ha realitzat a partir de la documentació que es troba a la secció “Installing R under Unix-alikes”, del document <downDir>/R-?.?.?/doc/manual/R-admin.html. Possiblement hi ha maneres millors de fer tot això. Aquesta almenys funciona (al menys a RedHat EL 5.0).

1.11. Install R devel (sources) from subversion

Sources are also available via https://svn.R-project.org/R/, the R Subversion repository. If you have a Subversion client (see http://subversion.apache.org/), you can check out and update the current ‘r-devel’ from https://svn.r-project.org/R/trunk/ and the current ‘r-patched’ from ‘https://svn.r-project.org/R/branches/R-x-y-branch/’ (where x and y are the major and minor number of the current released version of R). E.g., use
svn checkout https://svn.r-project.org/R/trunk/ path
to check out ‘r-devel’ into directory path. The alpha, beta and RC versions of an upcoming x.y.0 release are available from ‘https://svn.r-project.org/R/branches/R-x-y-branch/’ in the four-week period prior to the release. Notes:
  • Note that ‘https:’ is required, and that the SSL certificate for the Subversion server of the R project should be recognized as from a trusted source.
  • Note that retrieving the sources by e.g. wget -r or svn export from that URL will not work: the Subversion information is needed to build R.
  • The Subversion repository does not contain the current sources for the recommended packages, which can be obtained by rsync or downloaded from CRAN. To use rsync to install the appropriate sources for the recommended packages, run from the top-level of the R sources:
    Command on a console
    ./tools/rsync-recommended
  • If you need to switch from trunk (devel) to any specific branch (such as from trunk to 2.14 during October 2011, in the 4-week period prior to the official release of branch 2.14.x), you can do so with:
    Command on a console
    export REPOS=https://svn.r-project.org/R
    svn switch $REPOS/branches/R-2-14-branch r-devel/R
  • If you want to fetch any specific branch from R directly through svn, you can do it by means of creating a new folder at the location you like (for instance, /home/youruser/r14-svn/), and run this command there:
Command on a console
svn checkout https://svn.r-project.org/R/branches/R-2-14-branch /home/youruser/r14-svn
If downloading manually from CRAN, do ensure that you have the correct versions of the recommended packages: if the number in the file VERSION is ‘x.y.z’ you need to download the contents of ‘http://CRAN.R-project.org/src/contrib/dir’, where dir is ‘x.y.z/Recommended’ for r-devel or x.y-patched/Recommended for r-patched, respectively, to directory src/library/Recommended in the sources you have unpacked. A suitable incantation from the top level of the R sources for R 2.14.0 using wget might be:
wget -r -l1 --no-parent -A\*.gz -nd -P src/library/Recommended http://CRAN.R-project.org/src/contrib/2.14.0/Recommended
After downloading manually you need to execute tools/link-recommended from the top level of the sources to make the requisite links in src/library/Recommended.
./tools/link-recommended
Then you can proceed to compile it, before being able to run it. Or optionally, you can also install it system-wide (not requried to run your new version of R).

1.11.1. Simple R compilation

As you are reading this file, you have unpacked the R sources and are presumably in the top directory. Issue the following commands:
./configure
make
However, if you want to compile R with shared libraries, so that programs such as RStudio can use that R, you need to run the configure command with the extra option enable-R-shlib:
./configure --enable-R-shlib
make
In case the making of the R program failed because of some old packages (such as "tools" or others compiled for earlier versions of R, etc), you can try cleaning the make environment first, and then call the make command again:
make clean
make
(If your make is not called `make', set the environment variable MAKE to its name, and use that name throughout these instructions.) This will take a while, giving you time to read `R-admin.html'. Then check the built system worked correctly, by
make check
and make the manuals by (as many options as preferred from)
Command on a console
make dvi	to create DVI versions
make pdf	to create PDF versions
make info	to create info files
However, please read the notes in `R-admin.html' about making the reference manual.

1.11.2. R Installation

You do not need to install R to run it: you can run R by the script `bin/R' which you can link or copy to any convenient place in your path. For a site-wide installation, use
Command on a console
make install
make install-dvi
make install-info
make install-pdf
choosing to install the manuals that you made. This installs to the default location (typically `/usr/local') for your platform: see the Installation and Administration Manual for other options.
For more information, or more detailed instructions, see: http://developer.r-project.org/SVNtips.html

1.12. Check devel Bioconductor packages corresponding to the R devel version

You can check them here: http://bioconductor.org/checkResults/devel/bioc-LATEST/

1.13. Eclipse Visual Debugger for R (StatEt)

To install Eclipse & Statet (for the visual debugger), you need to compiple R for yourself after applying a small patch to an R source file, and your need to follow these extra (non fully-intuitive) steps:
  1. Download your copy of R source (from subversion or other means), so that you can compile it later.
  2. Apply the patches from http://www.walware.de/it/downloads/statet.mframe for your version of R
  3. build and install R
  4. Add rj package in your R installation. http://www.walware.de/it/downloads/rj.html
    Add rj package in your R installation
    install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1")
  5. Install StatEt by hand (it seems that Eclipse doesn't use theproxy info we provided):
  6. Follow the tutorial from Eclipse once the Statet is installed for the configuration, etc.
  7. Launch the R Console no longer from the Run configurations menu (or favorites), but from the Debug configurations menu (or favorites) in order to have the debugger functionality activated
  8. set breakpoints in your functions
  9. use either Ctrl+R, Ctrl+F (submit function) or Ctrl+R, Ctrl+S (source the file) in order to install your breakpoints (the breakpoint icon will have a check in that case)
  10. run the code and the Debug perspective will be opened with a Variables View, Breakpoints View, a nice overview of the stack etc. You can step through your code using F6. To emulate a step-in, put the cursor on the function want to step into and press Ctrl+F5.
See also this tutorial on the Eclipse Debugger (for Java), which might serve as an introduction resoruce for beginners in Eclipse and/or Debugging. http://eclipsetutorial.sourceforge.net/debugger.html From email lists (they are citing our video from User!2011 !!):

[StatET-user] StatET support for visual/advanced R debugging
Tobias Verbeke tobias.verbeke at openanalytics.eu
Thu Aug 25 08:04:54 CEST 2011

Hi Brian,

On 08/24/2011 03:34 PM, Brian G. Peterson wrote:
On Wed, 2011-08-24 at 16:09 +0300, Jonathan Rosenblatt wrote:
It was presented in UseR2011
Try StatET2.0 from http://www.walware.de/it/statet/installation.mframe

I'm thrilled to hear that, but it appears that the update site:

http://download.walware.de/user2011

is blocked. Perhaps it was only available during UseR!2011 ?

I just tested with a vanilla Indigo (Eclipse for Java developers)
and it installs without hiccups.

You get a 404 when browsing to the URL, but if you enter
the address as an update site (under Help Install New Software
Add) things work out perfectly fine.

Is the StatET presentation from useR available?

There is a small video fragment here:

http://vimeo.com/27901400

The short installation instructions are:

1) apply the patches from
http://www.walware.de/it/downloads/statet.mframe
for your version of R

2) build and install R

3) install the latest and greatest StatET from the
above URL

4) launch the R Console no longer from the Run configurations
menu (or favorites), but from the Debug configurations menu
(or favorites) in order to have the debugger functionality
activated

5) set breakpoints in your functions

6) use either Ctrl+R, Ctrl+F (submit function) or Ctrl+R, Ctrl+S (source
the file) in order to install your breakpoints (the breakpoint
icon will have a check in that case)

7) run the code and the Debug perspective will be opened with a
Variables View, Breakpoints View, a nice overview of the stack etc.
You can step through your code using F6. To emulate a step-in, put
the cursor on the function want to step into and press Ctrl+F5.

8) Have fun as never before.

There is some more documentation in the StatET User Guide you
can find under Help Help Contents StatET User Guide R Visual Debugger.

We made some installers for Windows and Mac (with patched R
included), but they are not ready for production yet (working
around some Windows limitations for the moment) — currently
they serve primarily to play with the debugger functionality.
I can send the link privately to interested people.

Don't hesitate if you would have further questions.

Best,
Tobias

1.14. Darrera versió estable de RKward

sudo add-apt-repository ppa:rkward-devel/rkward-stable

1.15. Solventar temporalment el problema del proxy amb Sys.setenv

Si ho necessitem per alguna raó, podem configurar una sessió d'R per a emprar el proxy, amb aquesta comanda dins de la consola d'R (via pàgina wiki i pluginR, via RKward, via RStudio, etc):
Command on an R console
Sys.setenv(http_proxy="http://your.proxy.domain:yourport")

1.16. Afegir els menus contextuals de Bazaar a RKward i altres KDE apps

Veure "QBazaar service menu": http://kde-look.org/content/show.php/QBazaar+service+menu?content=142321

Service menu for kde apps (such as Dolphin 1.6.x, rkward 0.5.7., ...) so that you can launch a few actions for QBazaar (program of a distributed version control system)

Merged information from two previous sources (1 & 2, see below) and adapted for the case where there was no folder \"ServiceMenu\" created for the user (under gnome desktop).

Sources:
(1) http://blog.saturnlaboratories.co.za/programs/qbazaar-desktop
(2) http://kde-apps.org/content/show.php/Bazaar-Servicemenu?content=115751

Thanks Thomas Friedrichsmeier for feedback.

Download this file and install it with the provided script inside the downloaded compressed file: http://kde-look.org/content/download.php?content=142321&id=1&tan=1082686
Noms alias d'aquesta pàgina: R | R i associats | ess | statet | eclipse | Configuració d'R i associats | ConfiguracióR | ConfiguracioR | RConf | RConfiguration | Config R | R Config
Image Seed: noun \ˈsēd\ : the beginning of something which continues to develop or grow

Knowledge seeds

Switch Language