[R] Factor to numeric

From: Jojje Andersson <dietaamigo_at_hotmail.com>
Date: Thu, 24 Apr 2008 09:41:12 +0200

Hello!
I have a problem whith a data.frame. I want to make a subset where some of the variables have values within ceartain limits. The variables are proportions like 1,00, 0,54, 0,00 etc. I don't get it right as R take the variables for factors.    

> ekobsub1 <- subset(ekob, PAP>0,25 & PAP<0,6 & CAP>0,1 & CAP<0,6 & FAP>0,1)
Error in `[.data.frame`(x, r, vars, drop = drop) : object "CAP" not found In addition: Warning message:
In Ops.factor(PAP, 0) : > not meaningful for factors  

> ekobn<-as.numeric(as.character(ekob[["PAP"]]))
Warning message:
NAs introduced by coercion    

Thanks!  

/Jojje  



[[elided Hotmail spam]]

px?sc_cmp2=JS_INT_SEMSN_NLPCV

        [[alternative HTML version deleted]]



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. Received on Thu 24 Apr 2008 - 08:04:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Apr 2008 - 10:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive