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
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
.
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
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
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
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
6 matches
Mail list logo