[R] What is a factor? [was :(no subject)]

Marc Schwartz MSchwartz at MedAnalytics.com
Wed Jan 12 15:35:49 CET 2005


On Wed, 2005-01-12 at 15:17 +0100, nicolas.deig at epfl.ch wrote:
> hi,
> 
> I am trying to grow a classification tree on some data, but I have a little
> problem. In order to do so I have to use a function like "tree" in R and on the
> internet help(tree) I get the following: 
> 
> "The left-hand-side (response) should be either a numerical vector when a
> regression tree will be fitted or a factor, when a classification tree is produced"
> 
> I would like to know what is a "factor" in R, is it numerical value with no
> formula or just a word??
> 
> Thanks in advance
> Nicolas

See ?factor and/or Chapter 4 "Ordered and Unordered Factors" in "An
Introduction to R".

Also, you might want to look into the 'rpart' package for an alternative
to 'tree'. rpart is included in the base R distribution:

library(rpart)
?rpart

HTH,

Marc Schwartz




More information about the R-help mailing list