User Tools

Site Tools


r

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
r [2017/02/01 09:24]
carl
r [2017/02/01 11:40] (current)
carl
Line 61: Line 61:
  
 N.B. : the comparator is '​=='​ N.B. : the comparator is '​=='​
 +
 +====== Notes ======
 +Pour faire ceci (avec SAS):
 +<code sas>data example_zhsites;​
 +  set example_zhsites;​
 +  if f_no_ebeds=1 then nbeds_e2=5;
 +run;</​code>​
 +en r, il faut passer par une boucle et assigner chaque item du vecteur ([i]) :
 +<code r>for(i in 1:​nrow(example_zhsites)) {
 +  if (example_zhsites$f_no_ebeds[i] == 1) {
 +    example_zhsites$nbeds_e2[i] = 5
 +  }
 +}</​code>​
 +
 +source : [[http://​stackoverflow.com/​questions/​23316161/​the-condition-has-length-1-and-only-the-first-element-will-be-used|The condition has length > 1 and only the first element will be used]]
r.txt · Last modified: 2017/02/01 11:40 by carl