[R] When factor is better than other types, such as vector and frame?
    Paul Hiemstra 
    p.hiemstra at geo.uu.nl
       
    Sun Aug 23 10:08:42 CEST 2009
    
    
  
Peng Yu schreef:
> Hi,
>
> It is easy to understand the types vector and frame.
>
> But I am wondering why the type factor is designed in R. What is the
> advantage of factor compare with other data types in R? Can somebody
> give an example in which case the type factor is much better than
> other data types?
>
> Regards,
> Peng
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.Hi, 
>   
Hi,
Factor is better when the  variable is categorical, such as 'Forest', 
'Woodland' etc. When performing for example an lm() the categorical 
variables have to be a factor in order for R to recognize it in that way.
cheers,
Paul
    
    
More information about the R-help
mailing list