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
On 12 Jan 2005 at 15:17, 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??Hi Nicolas ?factor will show you what it is. Description: The function 'factor' is used to encode a vector as a factor (the terms 'category' and 'enumerated type' are also used for factors). If 'ordered' is 'TRUE', the factor levels are assumed to be ordered. For compatibility with S there is also a function 'ordered'. Cheers Petr> > Thanks in advance > Nicolas > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.htmlPetr Pikal petr.pikal at precheza.cz
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 > NicolasSee ?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
I think you will find all the doc in the help files> ?factor()gets The function 'factor' is used to encode a vector as a factor (the terms 'category' and 'enumerated type' are also used for factors). If 'ordered' is 'TRUE', the factor levels are assumed to be ordered. For compatibility with S there is also a function 'ordered'. 'is.factor', 'is.ordered', 'as.factor' and 'as.ordered' are the membership and coercion functions for these classes. Usage: factor(x, levels = sort(unique.default(x), na.last = TRUE), labels = levels, exclude = NA, ordered = is.ordered(x)) ordered(x, ...) etc... c'est une variable de type cat?gorique! whose levels (values) are strings To get help: type ?functionname or if you are under Windows see the menu "Help\Html help" and look under Packages. What you will want first are the "Base" and "Statistics" packages Anne ----- Original Message ----- From: <nicolas.deig at epfl.ch> To: <r-help at stat.math.ethz.ch> Sent: Wednesday, January 12, 2005 3:17 PM Subject: [R] (no subject)> > hi, > > I am trying to grow a classification tree on some data, but I have alittle> problem. In order to do so I have to use a function like "tree" in R andon 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 isproduced"> > I would like to know what is a "factor" in R, is it numerical value withno> formula or just a word?? > > Thanks in advance > Nicolas > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html>
Hi all, I've got a small, practical question, which untill now I couldn't solve (otherwhise I wouldn't mail it, right?) First of all, I'm talking about R 2.0.1 on a winxp system (using the default graphical interface being 'Rgui'). When I make plots, using dates on the x-axis, it puts the labels in Dutch, which is nice (since it's my mother tongue) unless I want them in English... Is there a way to change this behaviour? (Can I change the labels etc to English?) tnx, Kurt Sys