User Tools

Site Tools


r:data_structures

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
r:data_structures [2019/09/19 18:10] – [Factors] hkimscilr:data_structures [2019/09/19 18:16] (current) – [Creating a Factor (Categorical Variable)] hkimscil
Line 241: Line 241:
 [1] 11 12 13 14 15 16 [1] 11 12 13 14 15 16
 </code> </code>
- 
-<WRAP box help>The above code is very useful. But, sometimes the recycling rule is very annoying. How would I avoid it? 
-</WRAP> 
  
 ====== Creating a Factor (Categorical Variable) ====== ====== Creating a Factor (Categorical Variable) ======
Line 266: Line 263:
  
 <code>> f <- factor(wday, c("Mon","Tue","Wed","Thu","Fri")) # c(...) part means "levels" not data  <code>> f <- factor(wday, c("Mon","Tue","Wed","Thu","Fri")) # c(...) part means "levels" not data 
-> f+> f  # note that there is no Fri in the below output.
  [1] Wed Thu Mon Wed Thu Thu Thu Tue Thu Tue  [1] Wed Thu Mon Wed Thu Thu Thu Tue Thu Tue
 Levels: Mon Tue Wed Thu Fri Levels: Mon Tue Wed Thu Fri
r/data_structures.1568884217.txt.gz · Last modified: 2019/09/19 18:10 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki