Re: [R] remove last char of a text string

2010-06-14 Thread Henrique Dallazuanna
Try: gsub(".$", "", c('01asap05a', '02ee04b')) On Mon, Jun 14, 2010 at 10:47 AM, glaporta wrote: > > Dear R experts, > is there a simple way to remove the last char of a text string? > substr() function use as parameter start end only... but my strings are of > different length... > 01asap05a

Re: [R] remove last char of a text string

2010-06-14 Thread Sarah Goslee
Sure. You can use nchar() to find out how long the string is. > teststring <- "01asap05a" > substr(teststring, 1, nchar(teststring)-1) [1] "01asap05" On Mon, Jun 14, 2010 at 9:47 AM, glaporta wrote: > > Dear R experts, > is there a simple way to remove the last char of a text string? > substr()

Re: [R] remove last char of a text string

2010-06-14 Thread Gustaf Rydevik
On Mon, Jun 14, 2010 at 3:47 PM, glaporta wrote: > > Dear R experts, > is there a simple way to remove the last char of a text string? > substr() function use as parameter start end only... but my strings are of > different length... > 01asap05a -> 01asap05 > 02ee04b -> 02ee04 > Thank you all, > G

[R] remove last char of a text string

2010-06-14 Thread glaporta
Dear R experts, is there a simple way to remove the last char of a text string? substr() function use as parameter start end only... but my strings are of different length... 01asap05a -> 01asap05 02ee04b -> 02ee04 Thank you all, Gianandrea -- View this message in context: http://r.789695.n4.nab