[R] Problem reading from a data frame

naw3 at duke.edu naw3 at duke.edu
Wed Jul 2 16:24:28 CEST 2008


Hi,

I have a data frame with strings that have two letters and four numbers. When I
store a whole row as a new vector and try to remove the preceding letters using
the gsub command, it returns characters of single numbers that have no relation
to the numbers in each string. I also noticed that when I view the new vector
before using gsub, it includes the original headers from the data frame. For
example,

The original row will contain (i'm not showing the headers):

MT2342    MT0982    MT2874

and after I use the command, 'gsub('[^0-9]','',PthwyGenes),' I get:

"6"    "6"    "8"

and this result no longer has any headers.

Does anyone know why this happens and how I can fix it?

Thanks,
-Nina



More information about the R-help mailing list