[R] convert factor data to numeric

andreas andreasseger at web.de
Fri Oct 15 05:41:29 CEST 2010


cheers for the quick reply.

Sorry I am getting a bit confused I have never used the anything else any
from of extension on read.csv what I did was: 

1. enter the data into excel and save it as comma delimited
2. then used: s1 <- read.csv("book1.csv")

If i try to run this

s1 <- read.table(textConnection("treat   absorb 
+ 0          1.8052 
+ 0.5       2.07075 
+ 1.0       2.2345"), header = TRUE) 

it comes with up with the following:

> source(.trPaths[7], echo=TRUE, max.deparse.length=150)
Fehler in source(.trPaths[7], echo = TRUE, max.deparse.length = 150) : 
  Objekt '.trPaths' nicht gefunden

the way i have done is is the following

> s1 <- read.csv("Book1.csv")
> head(s1)
  treat.absorb
1     0;1.8052
2  0.5;2.07075
3     1;2.2345
> str(s1) 
'data.frame':   3 obs. of  1 variable:
 $ treat.absorb: Factor w/ 3 levels "0.5;2.07075",..: 2 1 3

hope that gives u a better insight




-- 
View this message in context: http://r.789695.n4.nabble.com/convert-factor-data-to-numeric-tp1012855p2996471.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list