R
is available for free for Windows, GNU/Linux and MacOS.
As for now, the latest version is 3.6.1
.
One common complain about R
is the frequency of updates. This is true, but can be sorted out with a good package manager. Of note, major updates (3.6.0
, late April 2019) are the only one forcing you to re-install extra-packages and are released on a yearly basis.
The reinstallr
package provides a function reinstallr()
function which takes care of install the packages you may missed by parsing your scripts and library()
calls.
Visit the download page and choose the corresponding installer for your platform. Mind that you will need Rtools to compile and install some packages.
You can either browse to the download page or better use the Homebrew package manager.
Robert Rudis wrote a nice blog post about a 100% homebrew r install.
Once homebrew
is installed, you can easily install/uninstall many programs with their dependencies and utilities. This implies to use the terminal. If you’re not comfortable with the use of the terminal, ask me! It is worth it. To install R
using brew write in the following:
brew install r
Updates for all your software can be easily performed and will be automatically handled by the following line:
brew update; brew upgrade
Any Linux distributions is bundled with a great package manager such as dpkg
or rpm
. Visit the appropriate webpage for your distribution here.
After you get the correct entry in your package manager, it should quite easy
sudo apt-get install r-base r-base-dev
Rstudio is an Integrated Development Editor, it wraps and interfaces R
but, R
needs to be installed first. The free-version contains everything you need.
Visit the download page and choose the corresponding installer for your platform. As for now, the latest version is 1.2.1335
.
See the blog entry about this major release.
They are 4 main panels in rstudio, but as the top-left is for scripting and by default missing, the layout should looks like
On the bottom-right panel, 5 tabs are present:
Click on the Packages
tab (1.) and select the select the Install
button (2.). Type tidyverse, remotes
in (3.)
It takes some time, usually 10 seconds up to 5 minutes for a single package depending on its size and compilation stage.
The packages can also be installed in the console (i.e. the bottom-left panel). The snapshot below shows you how to install remotes
using the console:
Of note, remotes
is handy when you want to install a development version, for example if a bug was fixed but the package not yet submitted to CRAN.
remotes::install_github("tidyverse/dplyr")
The complaint of very frequent updates might be legitimate as it could be cumbersome to maintain R
up-to-date when you have many packages. Actually, it is as easy as:
update.packages()
But, you could also use the green Update
button next to the Install
(located in the Packages
tab). The advantage is that you can check which package you would like to update and look at the actual changes by clicking on the NEWS
link.
The bioconductor resource will be detailed later, but to save time, copy / paste the following code into the console to install for exmple the GEOquery
package:
# to install the version 3.8 of the bioconductor installer.
install.packages("BiocManager")
BiocManager::install("GEOquery")
There is no interface for bioconductor packages in Rstudio thus you need to run the following lines to update them (you will be asked if you want to update some / all / none):
BiocManager::install()
Copy / paste the code below and you should obtain the following plot.
library("tidyverse")
mtcars %>%
gather(key = "measurement", value = "value", drat, wt) %>%
ggplot(aes(x = value, y = mpg, colour = measurement)) +
geom_point() +
geom_smooth(method = "loess") +
theme_bw(14)
If not, please contact me with the error produced and the output of
devtools::session_info()
## Warning in system("timedatectl", intern = TRUE): running command
## 'timedatectl' had status 1
## ─ Session info ──────────────────────────────────────────────────────────
## setting value
## version R version 3.5.3 (2019-03-11)
## os Debian GNU/Linux 9 (stretch)
## system x86_64, linux-gnu
## ui X11
## language (EN)
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2019-09-13
##
## ─ Packages ──────────────────────────────────────────────────────────────
## package * version date lib source
## assertthat 0.2.1 2019-03-21 [2] CRAN (R 3.5.3)
## backports 1.1.4 2019-04-10 [2] CRAN (R 3.5.3)
## broom 0.5.2 2019-04-07 [2] CRAN (R 3.5.3)
## callr 3.2.0 2019-03-15 [2] CRAN (R 3.5.3)
## cellranger 1.1.0 2016-07-27 [2] CRAN (R 3.5.3)
## cli 1.1.0 2019-03-19 [2] CRAN (R 3.5.3)
## colorspace 1.4-1 2019-03-18 [2] CRAN (R 3.5.3)
## crayon 1.3.4 2017-09-16 [2] CRAN (R 3.5.3)
## desc 1.2.0 2018-05-01 [2] CRAN (R 3.5.3)
## devtools 2.0.2 2019-04-08 [2] CRAN (R 3.5.3)
## digest 0.6.18 2018-10-10 [2] CRAN (R 3.5.3)
## dplyr * 0.8.0.1 2019-02-15 [2] CRAN (R 3.5.3)
## evaluate 0.13 2019-02-12 [2] CRAN (R 3.5.3)
## forcats * 0.4.0 2019-02-17 [2] CRAN (R 3.5.3)
## fs 1.2.7 2019-03-19 [2] CRAN (R 3.5.3)
## generics 0.0.2 2018-11-29 [2] CRAN (R 3.5.3)
## ggplot2 * 3.1.1 2019-04-07 [2] CRAN (R 3.5.3)
## glue 1.3.1 2019-03-12 [2] CRAN (R 3.5.3)
## gtable 0.3.0 2019-03-25 [2] CRAN (R 3.5.3)
## haven 2.1.0 2019-02-19 [2] CRAN (R 3.5.3)
## hms 0.4.2 2018-03-10 [2] CRAN (R 3.5.3)
## htmltools 0.3.6 2017-04-28 [2] CRAN (R 3.5.3)
## httr 1.4.0 2018-12-11 [2] CRAN (R 3.5.3)
## jsonlite 1.6 2018-12-07 [2] CRAN (R 3.5.3)
## knitr 1.22 2019-03-08 [2] CRAN (R 3.5.3)
## labeling 0.3 2014-08-23 [2] CRAN (R 3.5.3)
## lattice 0.20-38 2018-11-04 [3] CRAN (R 3.5.3)
## lazyeval 0.2.2 2019-03-15 [2] CRAN (R 3.5.3)
## lubridate 1.7.4 2018-04-11 [2] CRAN (R 3.5.3)
## magrittr 1.5 2014-11-22 [2] CRAN (R 3.5.3)
## memoise 1.1.0 2017-04-21 [2] CRAN (R 3.5.3)
## modelr 0.1.4 2019-02-18 [2] CRAN (R 3.5.3)
## munsell 0.5.0 2018-06-12 [2] CRAN (R 3.5.3)
## nlme 3.1-139 2019-04-09 [3] CRAN (R 3.5.3)
## pillar 1.3.1 2018-12-15 [2] CRAN (R 3.5.3)
## pkgbuild 1.0.3 2019-03-20 [2] CRAN (R 3.5.3)
## pkgconfig 2.0.2 2018-08-16 [2] CRAN (R 3.5.3)
## pkgload 1.0.2 2018-10-29 [2] CRAN (R 3.5.3)
## plyr 1.8.4 2016-06-08 [2] CRAN (R 3.5.3)
## prettyunits 1.0.2 2015-07-13 [2] CRAN (R 3.5.3)
## processx 3.3.0 2019-03-10 [2] CRAN (R 3.5.3)
## ps 1.3.0 2018-12-21 [2] CRAN (R 3.5.3)
## purrr * 0.3.2 2019-03-15 [2] CRAN (R 3.5.3)
## R6 2.4.0 2019-02-14 [2] CRAN (R 3.5.3)
## Rcpp 1.0.1 2019-03-17 [2] CRAN (R 3.5.3)
## readr * 1.3.1 2018-12-21 [2] CRAN (R 3.5.3)
## readxl 1.3.1 2019-03-13 [2] CRAN (R 3.5.3)
## remotes 2.0.4 2019-04-10 [2] CRAN (R 3.5.3)
## rlang 0.3.4 2019-04-07 [2] CRAN (R 3.5.3)
## rmarkdown 1.12 2019-03-14 [2] CRAN (R 3.5.3)
## rprojroot 1.3-2 2018-01-03 [2] CRAN (R 3.5.3)
## rstudioapi 0.10 2019-03-19 [2] CRAN (R 3.5.3)
## rvest 0.3.3 2019-04-11 [2] CRAN (R 3.5.3)
## scales 1.0.0 2018-08-09 [2] CRAN (R 3.5.3)
## sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 3.5.3)
## stringi 1.4.3 2019-03-12 [2] CRAN (R 3.5.3)
## stringr * 1.4.0 2019-02-10 [2] CRAN (R 3.5.3)
## testthat 2.0.1 2018-10-13 [2] CRAN (R 3.5.3)
## tibble * 2.1.1 2019-03-16 [2] CRAN (R 3.5.3)
## tidyr * 0.8.3 2019-03-01 [2] CRAN (R 3.5.3)
## tidyselect 0.2.5 2018-10-11 [2] CRAN (R 3.5.3)
## tidyverse * 1.2.1 2017-11-14 [2] CRAN (R 3.5.3)
## usethis 1.5.0 2019-04-07 [2] CRAN (R 3.5.3)
## withr 2.1.2 2018-03-15 [2] CRAN (R 3.5.3)
## xfun 0.6 2019-04-02 [2] CRAN (R 3.5.3)
## xml2 1.2.0 2018-01-24 [2] CRAN (R 3.5.3)
## yaml 2.2.0 2018-07-25 [2] CRAN (R 3.5.3)
##
## [1] /root/r_libs
## [2] /usr/local/lib/R/site-library
## [3] /usr/local/lib/R/library