Re: [R] list substring

2009-04-01 Thread calpeda
I was suggested to use x = data.frame(string = c( "x1", "x2", "x3")) x apply(x,1,substr,1,4) and it's worked good! Thank you all Wacek Kusnierczyk wrote: > > calpeda wrote: >> thank you, >> but I m importing data from a txt file and I have a matrix of n*1 >> The function str s

Re: [R] list substring

2009-04-01 Thread Wacek Kusnierczyk
calpeda wrote: > thank you, > but I m importing data from a txt file and I have a matrix of n*1 > The function str seems to work only from 1*n > > you see, it would help if you provided more details from the start. you may still need to do it; it seems that both solutions you were given (mine

Re: [R] list substring

2009-04-01 Thread calpeda
thank you, but I m importing data from a txt file and I have a matrix of n*1 The function str seems to work only from 1*n Wacek Kusnierczyk wrote: > > calpeda wrote: >> hi >> I ve a list of item x = ( "x1" >>"x2" >>"

Re: [R] list substring

2009-04-01 Thread Jorge Ivan Velez
Dear celpeda, Try this: x = c( "x1", "x2", "x3") substr(x,1,4) [1] "" "" "" See ?substr for more details. HTH, Jorge On Wed, Apr 1, 2009 at 9:30 AM, calpeda wrote: > > hi > I ve a list of item x = ( "x1" > "x2" >

Re: [R] list substring

2009-04-01 Thread Wacek Kusnierczyk
calpeda wrote: > hi > I ve a list of item x = ( "x1" >"x2" >"x3") > > I need to extract a new vector y = ( "", >"", >

Re: [R] list substring

2009-04-01 Thread Dimitris Rizopoulos
try this: x <- c("x1", "x2", "x3") substr(x, 1, 4) Best, Dimitris calpeda wrote: hi I ve a list of item x = ( "x1" "x2" "x3") I need to extract a new vector y = ( "",