Re: [R] Drop last numeral

2010-01-12 Thread LCOG1
The Below worked best for my purposes. Thanks everyone. Data<-c("1131", "1132", "1731" ,"1732" ,"1821" ,"1822", "2221" ,"", "2241" ,"2242","414342" ,"414371" ,"414372") substr(Data,1,nchar(Data)-1) LCOG1 wrote: > > Hello all, > Frustrated and i know you can help > > I need to dr

Re: [R] Drop last numeral

2010-01-12 Thread Steve Taylor
Try this: substr(Data,1,nchar(Data)-1) Steve >>> From: LCOG1 To: Date: 13/Jan/2010 9:15 a.m. Subject: [R] Drop last numeral Hello all, Frustrated and i know you can help I need to drop the last numeral of each of my values in my data set. So for the following i have

Re: [R] Drop last numeral

2010-01-12 Thread Greg Snow
. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of LCOG1 > Sent: Tuesday, January 12, 2010 11:37 AM > To: r-help@r-project.org > Subj

Re: [R] Drop last numeral

2010-01-12 Thread Dennis Murphy
Also try sub('[0-9]$', '', Data) [1] "113" "113" "173" "173" "182" "182" "222" "222" "224" [10] "224" "41434" "41437" "41437" HTH, Dennis On Tue, Jan 12, 2010 at 10:36 AM, LCOG1 wrote: > > Hello all, > Frustrated and i know you can help > > I need to drop the last numeral of

Re: [R] Drop last numeral

2010-01-12 Thread Nutter, Benjamin
ar(Data)-1) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of LCOG1 Sent: Tuesday, January 12, 2010 1:37 PM To: r-help@r-project.org Subject: [R] Drop last numeral Hello all, Frustrated and i know you can help I need to drop the la

[R] Drop last numeral

2010-01-12 Thread LCOG1
Hello all, Frustrated and i know you can help I need to drop the last numeral of each of my values in my data set. So for the following i have tried the ?substring but since i have to specify the length, but because my data are of varying lengths it doenst work so well Data<-c("1131", "1132