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@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

______________________________________________
R-help@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.

Reply via email to