Oh, wait a second. I misread your original post. Please ignore my
truly incorrect suggestion.
-- Bert
On Fri, Mar 1, 2024 at 7:57 AM Bert Gunter wrote:
>
> Here's another *incorrect* way to do it -- incorrect because it will
> not always work, unlike Iris's correct solution. But it does not
> re
Here's another *incorrect* way to do it -- incorrect because it will
not always work, unlike Iris's correct solution. But it does not
require PERL type matching. The idea: separate the two vowels in the
regex by a character that you know cannot appear (if there is such)
and match it optionally, e.g
Hi Iris,
Thank you. Further, very nice solution.
Best,
Iago
On 01/03/2024 12:49, Iris Simmons wrote:
> Hi Iago,
>
>
> This is not a bug. It is expected. Patterns may not overlap. However, there
> is a way to get the result you want using perl:
>
> ```R
> gsub("([aeiouAEIOU])(?=[aeiouAEIOU])", "
Hi Iago,
This is not a bug. It is expected. Patterns may not overlap. However, there
is a way to get the result you want using perl:
```R
gsub("([aeiouAEIOU])(?=[aeiouAEIOU])", "\\1_", "aerioue", perl = TRUE)
```
The specific change I made is called a positive lookahead, you can read
more about
Hi all,
I tested next command:
gsub("([aeiouAEIOU])([aeiouAEIOU])", "\\1_\\2", "aerioue")
with the following output:
[1] "a_eri_ou_e"
So, there are two consecutive vowels where an underscore is not added.
May it be a bug? Is it expected (bug or not)? Is there any chance to get
what I want (a
Hi Charles,
It's not clear to me what you mean by "doesn't work".
> test <- "Interesting 1\nPoint\n"
> cat(test)
Interesting 1
Point
> test1 <- gsub("ing 1\nP","ing 3\nP", test)
> cat(test1)
Interesting 3
Point
>
Cheers
Andrew
On Tue, May 17, 2011 at 10:45:31AM +0200, Thibault Charles wrote:
The backslashes in the patt argument need to be doubled since "\" is a
special regex character. Or it may work to set fixed =TRUE.
Either:
original <- "INFILTRATION INF_BASE \\n AIRCHANGE=1"
replace <- "INFILTRATION INF_BASE \n AIRCHANGE=3"
new_texte <- gsub(patt=original,replace,text)
Or:
ibb
Envoyé : mardi 17 mai 2011 11:15
À : r-help@r-project.org
Objet : Re: [R] gsub() issue...
Hello Thibault Charles,
> I have the following text :
> text <- INFILTRATION INF_BASE
>
> AIRCHANGE=1
becomes:
text <- "INFILTRATION INF_BASE\nAIRCHANGE=1"
> original
Hello Thibault Charles,
> I have the following text :
> text <- INFILTRATION INF_BASE
>
> AIRCHANGE=1
becomes:
text <- "INFILTRATION INF_BASE\nAIRCHANGE=1"
> original <- "INFILTRATION INF_BASE \n AIRCHANGE=1"
There are spaces around "\n". That's why text != original
Try
original <- "INFI
Hello R helpers,
I get a problem using gsub() function.
I have the following text :
text <- INFILTRATION INF_BASE
AIRCHANGE=1
Then my code is :
original <- "INFILTRATION INF_BASE \n AIRCHANGE=1"
replace <- "INFILTRATION INF_BASE \n AIRCHANGE=3"
new_texte <- gsub
t.org]
On Behalf Of Uwe Ligges
Sent: Tuesday, June 29, 2010 4:11 AM
To: Jason Rupert
Cc: r-help@r-project.org
Subject: Re: [R] gsub issue in R 2.11.1, but not present in 2.9.2
On 29.06.2010 12:47, Jason Rupert wrote:
Previously in R 2.9.2 I used the following to convert from an improperly
formatte
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Bert Gunter
> Sent: Tuesday, June 29, 2010 11:08 AM
> To: 'Jason Rupert'; 'Duncan Murdoch'
> Cc: r-help@r-project.org
> Subject: Re: [R
ice to double backslashes
should be heeded as much as possible. Unfortunately, I don't think it's
always possible:
> newlineString <- "first line\nsecond line\n"
> print(newlineString)
[1] "first line\nsecond line\n"
> cat(newlineString)
first line
second
ecause there is already sufficient confusion that the
typo may totally bewilder people.
-- Bert
Bert Gunter
Genentech Nonclinical Statistics
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Uwe Ligges
> Sent: Tue
On 29.06.2010 12:47, Jason Rupert wrote:
Previously in R 2.9.2 I used the following to convert from an improperly
formatted NA string into one that is a bit more consistent.
gsub("N\A", "NA", "N\A", fixed=TRUE)
This worked in R 2.9.2, but now in R 2.11.1 it doesn't seem to work an throws
t
On 29/06/2010 6:47 AM, Jason Rupert wrote:
Previously in R 2.9.2 I used the following to convert from an improperly formatted NA string into one that is a bit more consistent.
gsub("N\A", "NA", "N\A", fixed=TRUE)
This worked in R 2.9.2, but now in R 2.11.1 it doesn't seem to work an throws
Previously in R 2.9.2 I used the following to convert from an improperly
formatted NA string into one that is a bit more consistent.
gsub("N\A", "NA", "N\A", fixed=TRUE)
This worked in R 2.9.2, but now in R 2.11.1 it doesn't seem to work an throws
the following error.
Error: '\A' is an unr
17 matches
Mail list logo