Bert Jacobs-2 wrote:
>
> I would like to replace the last tree characters of the values of a
> certain
> column in a dataframe.
>
>
Besides the mentioned standard method: I found the subset of string
operations in Hadley Wickhams stringr package helpful. They have a much more
consistent interf
Will this do it for you:
> x <- c('asdfasdf', 'sadfasdf/:/', 'sadf', 'asdf/:/')
> sub("/:/$", '', x)
[1] "asdfasdf" "sadfasdf" "sadf" "asdf"
On Sun, Apr 3, 2011 at 7:39 PM, Bert Jacobs
wrote:
> Hi,
>
>
>
> I would like to replace the last tree characters of the values of a certain
> column i
Thx
I could imagine it was so simple.:)
Bert
-Original Message-
From: Dirk Eddelbuettel [mailto:e...@master.debian.org] On Behalf Of Dirk
Eddelbuettel
Sent: 04 April 2011 01:39
To: Bert Jacobs
Cc: r-help@r-project.org
Subject: Re: [R] replace last 3 characters of string
On Mon, Apr 04
On Mon, Apr 04, 2011 at 01:39:34AM +0200, Bert Jacobs wrote:
> I would like to replace the last tree characters of the values of a certain
> column in a dataframe.
>
> This replacement should only take place if the last three characters
> correspond to the value "/:/" and they should be replaced w
Hi,
I would like to replace the last tree characters of the values of a certain
column in a dataframe.
This replacement should only take place if the last three characters
correspond to the value "/:/" and they should be replaced with ""(blank)
I cannot perform a simple gsub because the chara
5 matches
Mail list logo