Step by step installation instructions for windows

  1. If you have fresh windows installation then please create a new user with login name without national characters. For example, user name “Mashenka” is ok, but “Машенька” is not ok. Username without national characters will greatly simplify your life afterwards.

With national characters in username there might be some problems in interaction between R and Rstudio. The root of the problem is the home folder name. For user “Машеньки” the path will be “C:/Users/Машенька/”.

If you use your windows for a long period of time and you would like to keep the username with national characters then follow details of this guide :)

During installation process double check that R and Rstudio are installed into folders without national characters. 
We recommend to install R into `C:/R`, and Rstudio into `C:/Rstudio`.
  1. Disable antivirus temporary for the setup procedure.

No, we don’t want to instal a virus on your computer :) Just we have encountered some problems during installation if anti-virus is active.

  1. Install classic R for windows.
  1. Install RStudio.

Rstudio — is just a pretty graphical interface to R. Brutal programmers may avoid Rstudio and use neovim or emacs :) Do not confuse Rstudio and R-studio, which is a non-free program for data recovery.

  1. Configure Rstudio.

Launch RStudio. Go to Tools — Global options.

In General section:

* remove mark 'Restore .Rdata into workspace in startup'.
* select `Never` in Save workspace to .Rdata on exit

In Sweave section:

* select 'knitr' in 'Weave .Rnw files using'.

In Code - Diagnostics section:

* выставьте все галочки.

  1. Install fresh version of Rtools.

These are additional tools, that allow us, for example, to create excel files from R.

  1. If the username contains national letters

7.1. Create special folder to store R pacakges, for example C:/Rlib. Avoid spaces and national letters!

7.2. In Rstudio console do

system("setx R_LIBS C:/Rlib")

You may replace C:/Rlib at your wish prodived you use no spaces nor national letters.

7.3. Relaunch Rstudio

7.4. Check that R knows the location to store package. Inside Rstudio console do

.libPaths()

It should point to C:/Rlib. Now all R packages will install into C:/Rlib.

  1. Install all required R packages for the course.

Download install_all.R. Open the file in RStudio (FileOpen file). Run it by selecting CodeSource with Echo. Internet connection is required for package installation.

You may encounter question: “Do you want to install from sources the packages which need compilation?”

You should answer “No”!

Explanation: some packages require a working copy of C++ on your computer to install packages from source. Without C++ on your computer installation from source will fail. If your answer “No” precompiled packages will be installed.

Appearing red messages do not signify an error, a sign of an error is the explicit word “Error”.

  1. Do not forget to turn on the antivirus back :)

Step by step installation instructions for macos

  1. Install classic R for macos.
  1. Install RStudio.

Rstudio — is just a pretty graphical interface to R. Brutal programmers may avoid Rstudio and use neovim or emacs :) Do not confuse Rstudio and R-studio, which is a non-free program for data recovery.

  1. Configure Rstudio.

Launch RStudio. Go to Tools — Global options.

In General section:

* remove mark 'Restore .Rdata into workspace in startup'.
* select `Never` in Save workspace to .Rdata on exit

In Sweave section:

* select 'knitr' in 'Weave .Rnw files using'.

In Code - Diagnostics section:

* check all boxes.

  1. In Rstudio console execute the command:
system("defaults write org.R-project.R force.LANG en_US.UTF-8")

This will force the use of english language.

  1. Install all required R packages for the course.

Download install_all.R. Open the file in RStudio (FileOpen file). Run it by selecting CodeSource with Echo. Internet connection is required for package installation.

You may encounter question: “Do you want to install from sources the packages which need compilation?”

You should answer “No”!

Explanation: some packages require a working copy of C++ on your computer to install packages from source. Without C++ on your computer installation from source will fail. If your answer “No” precompiled packages will be installed.

Appearing red messages do not signify an error, a sign of an error is the explicit word “Error”.

Пошаговая установка R для linux (на примере Ubuntu)

  1. Добавьте официальный репозиторий R:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
sudo apt update

Вместо bionic (для 18.04) должно быть кодовое название версии Ubuntu (disco для 19.04)

  1. Установите классический R:
sudo apt-get install r-base r-base-dev
  1. Установите RStudio.

Rstudio — это всего лишь удобная красивая графическая оболочка к R. Суровые брутальные программисты могут вполне обойтись и без Rstudio :) Не спутайте Rstudio с R-studio, платной программой для восстановления данных.

  1. Настройте Rstudio.

Запустите RStudio. Зайдите в раздел Tools — Global options.

В разделе General:

* уберите галочку у Restore .Rdata into workspace in startup.
* выберите `Never` у Save workspace to .Rdata on exit

В разделе Sweave:

* "Weave .Rnw files using" выберите knitr.

В разделе Code - Diagnostics:

* выставьте все галочки.

  1. Для пакетов R, скачивающих данные из Интернета, может потребоваться установка дополнительных библиотек linux
sudo apt-get install libcurl4-openssl-dev libxml2-dev libssl-dev
  1. Установите все необходимые для курса пакеты R.

Скачайте файл install_all.R. Откройте его в RStudio (FileOpen file). Запустите, выбрав CodeSource with Echo. При этом требуется соединение с Интернетом.

Бегущие красные надписи не означают ошибок, признаком ошибки является только явное сообщение Error.

Примечания:

  1. На ubuntu Rstudio узнает содержимое переменной PATH из файла etc/environ. Поэтому если в этом файле в переменной PATH нет пути к латеху, то Rstudio не увидит латех. Достаточно добавить путь к латеху в этом файле :)