[R] "Re: Change class factor to numeric"

Ivan Calandra ivan.calandra at uni-hamburg.de
Tue May 18 17:49:54 CEST 2010


Hi,

I think that providing the output from str(data array or whatever you 
have) would help.
Because, for now, we don't have much idea of what you really have.
Moreover, some sample data is always welcomed (using the function dput 
for example)

Ivan


Le 5/18/2010 17:36, Arantzazu Blanco Bernardeau a écrit :
>
> sorry I had a mistake sending my question without a subject. I do resend again. Please excuse me.
>    
>> 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 variable is resting as factor, and the linear model is not valid (for my purposes).
>> The decimal commas have been converted to decimal points, so I have no idea of what to do.
>> Thanks a lot
>>
>>
>> Arantzazu Blanco Bernardeau
>> Dpto de Química Agrícola, Geología y Edafología
>> Universidad de Murcia-Campus de Espinardo
>>
>>
>>
>>
>>
>>
>> _________________________________________________________________
>> Diseñar aplicaciones tiene premio. ¡Si eres desarrollador no esperes más!
>> http://www.imaginemobile.es
>>      
>   		 	   		
> _________________________________________________________________
> Recibe en tu HOTMAIL los emails de TODAS tus CUENTAS. + info
>
> ______________________________________________
> 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.
>
>    

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php



More information about the R-help mailing list