On Thu, 24-Sep-2015 at 12:38PM +0200, peter dalgaard wrote:
|>
|> On 24 Sep 2015, at 12:05 , Thierry Onkelinx wrote:
|>
|> > gsub("[A|K]\\|", "", x)
|>
|> That'll probably do it, but what was the point of the | in [A|K] ??
|> I don't think it does what I think you think it does...
|> Somewha
To: Thierry Onkelinx
Cc: R-help
Subject: Re: [R] Special characters in regular expressions
On 24 Sep 2015, at 12:05 , Thierry Onkelinx
wrote:
> gsub("[A|K]\\|", "", x)
That'll probably do it, but what was the point of the | in [A|K] ?? I don't
think it does what
On 24 Sep 2015, at 12:05 , Thierry Onkelinx wrote:
> gsub("[A|K]\\|", "", x)
That'll probably do it, but what was the point of the | in [A|K] ?? I don't
think it does what I think you think it does...
Somewhat safer, maybe:
gsub("\\|[AK]\\|","\\|", x)
(avoids surprises from, say, "LBAM 5|A|
gsub("[A|K]\\|", "", x)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
To call in the statistician after the experiment is done ma
I need to change a vector dd that looks like this:
c("LBAM 5|A|15C|3h", "LBAM 5|K|15C|2h")
into this:
c("LBAM 5|15C|3h", "LBAM 5|15C|2h")
It's not very imaginative, but I could use a complicated nesting of
gsub() as so:
gsub("-", "\\|", gsub("K-", "", gsub("A-", "", gsub("\\|", "-", dd
Or
5 matches
Mail list logo