[R] Factor to variable

2010-06-05 Thread bjlwilkinson
I have a data frame called z that includes four columns: 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 I am trying to convert the 3rd column to the numeric value excluding the X so that I can produce a

Re: [R] Factor to variable

2010-06-05 Thread Phil Spector
Try z$Col3 = as.numeric(sub('^X','',as.character(z$Col3))) - Phil Spector Statistical Computing Facility Department of Statistics

[R] Factor to variable

2010-06-05 Thread bjlwilkinson
I have a data frame called z that includes four columns: 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 I am trying to convert the 3rd column to the numeric value excluding the X so that I can produce a

Re: [R] Factor to variable

2010-06-05 Thread Pete B
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