[R] Condition to factor (easy to remember)

Dieter Menne dieter.menne at menne-biomed.de
Wed Sep 30 14:31:15 CEST 2009




David Winsemius wrote:
> 
> 
>> # Typical C-Programmer style
>> factor(levs[as.integer(data >10)+1], levels=levs)
> 
> In your code the as.integer function is superfluous 

Oops... done too much c# lately, getting invalid cast challenged.

Dieter


-- 
View this message in context: http://www.nabble.com/Condition-to-factor-%28easy-to-remember%29-tp25676411p25680111.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list