[R] Factor to variable

From: <bjlwilkinson_at_gmail.com>
Date: Sat, 05 Jun 2010 14:03:09 +0000


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 lattice plot.

I have tried a number of approaches including z$Col3[z$Col3=="X0.1"]="0.1" as a first step but get an error: invalid factor level NAs generated.

Sent from my BlackBerry® wireless device



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 Sat 05 Jun 2010 - 14:13:05 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 Sat 05 Jun 2010 - 14:50:26 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