Re: [R] Problem reading from a data frame

2008-07-02 Thread Marc Schwartz
Not likely the factor issue: x <- factor(c("MT2342","MT0982","MT2874")) > x [1] MT2342 MT0982 MT2874 Levels: MT0982 MT2342 MT2874 > gsub("[^0-9]", "", x) [1] "2342" "0982" "2874" gsub() and friends coerce to character internally already: > gsub function (pattern, replacement, x, igno

Re: [R] Problem reading from a data frame

2008-07-02 Thread jim holtman
Seems to work fine for me: > x <- c("MT2342","MT0982","MT2874") > gsub("[^0-9]", "", x) [1] "2342" "0982" "2874" > You might have 'factors' so you should use as.character to convert to character strings: gsub('[^0-9]','',as.character(PthwyGenes)) On Wed, Jul 2, 2008 at 10:24 AM, <[EMAI

Re: [R] Problem reading from a data frame

2008-07-02 Thread Jorge Ivan Velez
Dear Nina, Is this what you want? x=c("MT2342","MT0982","MT2874") substr(x,3,nchar(x)) HTH, Jorge On Wed, Jul 2, 2008 at 10:24 AM, <[EMAIL PROTECTED]> wrote: > 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 t