quot;
It works even if a variable name starts with a "p":
> funnyReplace("pmin(p)", c("pmin", "pmax"))
[1] "pmin(1 - P)"
and you can specify an arbitrary number of protected words.
Cheers,
H.
Best wishes,
Alrik
-Ursprüngliche Nach
---
Von: Hervé Pagès [mailto:hpa...@fredhutch.org]
Gesendet: Samstag, 28. Februar 2015 23:29
An: Alrik Thiem; r-help@r-project.org
Betreff: Re: [R] Substring replacement in string
Hi Alrik,
With the Biostrings/IRanges infrastructure (Bioconductor packages), you
can do this with:
libra
Hi Alrik,
With the Biostrings/IRanges infrastructure (Bioconductor packages), you
can do this with:
library(Biostrings)
x0 <- BString("pmin(pmax(pmin(x1, X2), pmin(X3, X4)) == Y, pmax(Z1,
z1))")
donttouch_words <- c("pmin", "pmax")
## Extract the substrings to modify (target substring
Dear Gabor,
That works perfectly!
Many thanks and best wishes,
Alrik
-Ursprüngliche Nachricht-
Von: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
Gesendet: Samstag, 28. Februar 2015 19:30
An: Alrik Thiem
Cc: r-help@r-project.org
Betreff: Re: [R] Substring replacement in string
bor Grothendieck [mailto:ggrothendi...@gmail.com]
> Gesendet: Samstag, 28. Februar 2015 13:35
> An: Alrik Thiem
> Cc: r-help@r-project.org
> Betreff: Re: [R] Substring replacement in string
>
> On Fri, Feb 27, 2015 at 5:19 PM, Alrik Thiem wrote:
>> I would like to replace all l
Ah, I see what you mean. Thanks for suggesting. I'll try.
-Ursprüngliche Nachricht-
Von: Michael Dewey [mailto:i...@aghmed.fsnet.co.uk]
Gesendet: Samstag, 28. Februar 2015 17:31
An: Alrik Thiem
Cc: r-help@r-project.org
Betreff: Re: AW: [R] Substring replacement in string
Your ori
1
. . . . . . .
61 1 1 1 1 0 0
62 1 1 1 1 0 1
-Ursprüngliche Nachricht-
Von: Michael Dewey [mailto:i...@aghmed.fsnet.co.uk]
Gesendet: Samstag, 28. Februar 2015 14:50
An: Alrik Thiem
Cc: r-help@r-project.org
Betreff: Re: [R] Substring replacement in string
Dear Alrik
This may seem a silly sugg
*Cc:* r-help@r-project.org
> *Betreff:* Re: [R] Substring replacement in string
>
>
>
> If your string will always represent an R expression, you could work with
>
> the expression directly with functions like all.names() and substitute().
>
>
>
> f <- f
0 0 0 0 0 0
2 0 0 0 0 0 1
. . . . . . .
61 1 1 1 1 0 0
62 1 1 1 1 0 1
-Ursprüngliche Nachricht-
Von: Michael Dewey [mailto:i...@aghmed.fsnet.co.uk]
Gesendet: Samstag, 28. Februar 2015 14:50
An: Alrik Thiem
Cc: r-help@r-project.org
Betreff: Re: [R] Substring replacement in string
Dear
icht-
Von: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
Gesendet: Samstag, 28. Februar 2015 13:35
An: Alrik Thiem
Cc: r-help@r-project.org
Betreff: Re: [R] Substring replacement in string
On Fri, Feb 27, 2015 at 5:19 PM, Alrik Thiem wrote:
I would like to replace all lower-case letters in a
Best wishes,
Alrik
-Ursprüngliche Nachricht-
Von: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
Gesendet: Samstag, 28. Februar 2015 13:35
An: Alrik Thiem
Cc: r-help@r-project.org
Betreff: Re: [R] Substring replacement in string
On Fri, Feb 27, 2015 at 5:19 PM, Alrik Thiem wrot
On Fri, Feb 27, 2015 at 5:19 PM, Alrik Thiem wrote:
> I would like to replace all lower-case letters in a string that are not part
> of certain fixed expressions. For example, I have the string:
>
> "pmin(pmax(pmin(x1, X2), pmin(X3, X4)) == Y, pmax(Z1, z1))"
>
> Where I would like to replace all l
Thiem
Cc: r-help@r-project.org
Betreff: Re: [R] Substring replacement in string
If your string will always represent an R expression, you could work with
the expression directly with functions like all.names() and substitute().
f <- function (expr)
{
toReplace <- setdiff(all.names(ex
If your string will always represent an R expression, you could work with
the expression directly with functions like all.names() and substitute().
f <- function (expr)
{
toReplace <- setdiff(all.names(expr), c("pmin", "pmax"))
toReplace <- grep(value = TRUE, "[a-z]", toReplace)
names(
Dear R-help list,
I would like to replace all lower-case letters in a string that are not part
of certain fixed expressions. For example, I have the string:
"pmin(pmax(pmin(x1, X2), pmin(X3, X4)) == Y, pmax(Z1, z1))"
Where I would like to replace all lower-case letters that do not belong to
the
15 matches
Mail list logo