: Thursday, May 28, 2009 12:31 PM
>> To: Caroline Bazzoli
>> Cc: r-help@r-project.org
>> Subject: Re: [R] String replacement in an expression
>>
>> Caroline Bazzoli wrote:
>>
>>> Dear R-experts,
>>>
>>> I need to replace in an express
> Cc: r-help@r-project.org
> Subject: Re: [R] String replacement in an expression
>
> Caroline Bazzoli wrote:
> > Dear R-experts,
> >
> > I need to replace in an expression the character "Cl" by "Cl+beta"
> >
> > But in the following
Caroline Bazzoli wrote:
> Dear R-experts,
>
> I need to replace in an expression the character "Cl" by "Cl+beta"
>
> But in the following case:
>
> form<-expression((Cl-(V *ka) ) +(V *Vm *exp(-(Clm/Vm) *t)))
>
> gsub("Cl","(Cl+beta)",as.character(form))
>
> We obtain:
>
> [1] "((Cl+beta) - (
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Caroline Bazzoli
> Sent: Thursday, May 28, 2009 8:41 AM
> To: r-help@r-project.org
> Subject: [R] String replacement in an expression
>
> Dear R-experts,
>
> I need to replace in an expression the character
Try matching on word boundaries as well:
> gsub("\\bCl\\b","(Cl+beta)",as.character(form))
[1] "((Cl+beta) - (V * ka)) + (V * Vm * exp(-(Clm/Vm) * t))"
See ?regexp
On Thu, May 28, 2009 at 11:41 AM, Caroline Bazzoli
wrote:
> Dear R-experts,
>
> I need to replace in an expression the character "C
5 matches
Mail list logo