Hi, Sorry, I'm not really getting what going on here ... perhaps having more domain knowledge would help me make better sense of our question.
In particular: On Tue, May 18, 2010 at 11:35 AM, Arantzazu Blanco Bernardeau <aramu...@hotmail.com> wrote: > > Hello > I have a data array with soil variables (caperf), in which the variable > "clay" is factor (as I see entering str(caperf)) . I need to do a regression > model, so I need to have arcilla (=clay) as a numeric variable. For that I > have entered > > as.numeric(as.character(arcilla)) > > and even entering > 'as.numeric(levels(arcilla))[arcilla]' The above code doesn't make sense to me ... Perhaps cleaning up your question and providing some reproducible example we can use to help show you the light (just describing what a variable has isn't enough -- give us minimal code we can paste into R that reproduces your problem). Alternatively, depending no what your "levels" mean, you might want to recode your data using "dummy variables" (I'm not sure if that's the official term) .. this is what I mean: http://dss.princeton.edu/online_help/analysis/dummy_variables.htm In your example, let's say you have four levels for "clay" ... maybe "soft", "hard", "smooth", "red" Instead of only using 1 variable with values 1-4, you would recode this into 4 variables with values 0,1 So, if one example has a value of "smooth" for clay. Instead of coding it like: clay: 3 You would do: soft: 0 hard: 0 smooth: 1 red : 0 -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact ______________________________________________ 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.