On Sat, Jan 30, 2010 at 10:39 AM, Jennifer Young
wrote:
> handling of variables in R to be very straightforward; sometimes I pine
> for Maple to do my algebra for me...
There are several interfaces to Computer Algebra Systems in R. Try
this (but read instructions on home page
http://ryacas.goo
ot what we want!
>> ## And sure enough ...
>>> eval(f)
>> Error in a * expression(1/t) : non-numeric argument to binary operator
>>
>> I think I understand why the z <- expression() approach does not work;
>> but I
>> do not understand why the z <- quote(
Inline below...
-Original Message-
From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
Sent: Friday, January 29, 2010 2:12 PM
To: Bert Gunter
Cc: Jennifer Young; r-help@r-project.org
Subject: Re: [R] evaluating expressions with sub expressions
If its good enough to have one level
dentical()
> tells me so). Could someone perhaps elaborate on this a bit more? And is
> there a yet simpler and more straightforward way to do the above than what I
> proposed?
>
> Cheers,
>
> Bert Gunter
> Genentech Nonclinical Statistics
>
>
> -Original Message--
-Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter
> Sent: Friday, January 29, 2010 1:38 PM
> To: 'Gabor Grothendieck'; 'Jennifer Young'
> Cc: r-help@r-project.org
> Subject: Re: [R]
re straightforward way to do the above than what I
proposed?
Cheers,
Bert Gunter
Genentech Nonclinical Statistics
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Gabor Grothendieck
Sent: Friday, January 29, 2010 11:01 AM
To: Jenn
The following recursively walks the expression tree. The esub
function is from this page (you may wish to read that entire thread):
http://tolstoy.newcastle.edu.au/R/help/04/03/1245.html
esub <- function(expr, sublist) do.call("substitute", list(expr, sublist))
proc <- function(e, env = parent.f
Hmm
I *think* this will work, but may break in a further sub routine.
It certainly works in this example, but my expression vector is used in
many scenarios and it will take a while to check them all.
For instance, I take the derivative of each element with respect to each
variable using
sapply(
Hi,
Would this do as an alternative syntax?
g1 <- quote(1/Tm)
mat <- list(0, bquote(f1*s1*.(g1)))
vals <- data.frame(f1=1, s1=.5, Tm=2)
sapply(mat, eval, vals)
HTH,
baptiste
On 29 January 2010 17:51, Jennifer Young
wrote:
> Hallo
>
> I'm having trouble figuring out how to evaluate an expres
Hallo
I'm having trouble figuring out how to evaluate an expression when one of
the variables in the expression is defined separately as a sub expression.
Here's a simplified example
mat <- expression(0, f1*s1*g1) # vector of formulae
g1 <- expression(1/Tm) # expansion of the definition
10 matches
Mail list logo