Table of Contents

CoursInformatique

Installation

R

sudo aptitude install r-base

RStudio

Télécharger RStudio Desktop pour Debian sur http://www.rstudio.com/products/rstudio/download/

sudo dpkg -i rstudio-0.98.1062-i386.deb

Plus propre ici : https://linuxcapable.com/how-to-install-r-programming-language-on-debian-linux/

Basics

Packages:

library(package)

Tips:

Structures:

Things that can be done with R (seen at the flamescourse)

Assign value = or <-, differences : in a function

N.B. : the comparator is '=='

Notes

Pour faire ceci (avec SAS):

data example_zhsites;
  set example_zhsites;
  if f_no_ebeds=1 then nbeds_e2=5;
run;

en r, il faut passer par une boucle et assigner chaque item du vecteur ([i]) :

for(i in 1:nrow(example_zhsites)) {
  if (example_zhsites$f_no_ebeds[i] == 1) {
    example_zhsites$nbeds_e2[i] = 5
  }
}

source : The condition has length > 1 and only the first element will be used