[R] Factor to variable
    Pete B 
    Peter.Brecknock at bp.com
       
    Sat Jun  5 18:51:24 CEST 2010
    
    
  
Hi
How about ...
# Data
lines = "Col1 Col2 Col3 Col4
Text1 Text2 X0.1 5
Text1 Text2 X0.2 10
Text1 Text2 X0.3 15
Text1 Text3 X0.1 5
Text1 Text3 X0.2 10
Text1 Text3 X0.3 15"
# Create Dataframe
DF <- read.table(textConnection(lines), header = TRUE, check.names = FALSE)
# Create Numeric Variable 
DF$Col5 = as.numeric(sub("X","",DF$Col3))
HTH
Pete
-- 
View this message in context: http://r.789695.n4.nabble.com/Factor-to-variable-tp2244337p2244384.html
Sent from the R help mailing list archive at Nabble.com.
    
    
More information about the R-help
mailing list