Uwe,
Very nice, thank you.
Rich
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide comm
On 09.06.2010 06:15, RICHARD M. HEIBERGER wrote:
Is there a cleaner way of combining two expressions.
This example works and gives what I want
plot(1:10)
aa<- expression(alpha==.05)
bb<- expression(beta ==.80)
aabb<- expression(alpha==.05 ~ ", " ~ beta ==.80)
text(5, 10, aa)
text(5, 9, bb)
Seb,
Thanks. That doesn't solve the problem of combining two expressions.
My aa and bb are expressions constructed somewhere else and passed to the
current function which wants to use them together. Your solution moves the
construction
of aa and bb into the function and is equivalent to my aabb.
On Wed, 9 Jun 2010 00:15:19 -0400,
"RICHARD M. HEIBERGER" wrote:
> text(5,1, parse(text=paste(deparse(aa[[1]]), deparse(bb[[1]]),
> sep="~"))) text(5,2, parse(text=paste(deparse(aa[[1]]),
> deparse(bb[[1]]), sep="~', '~")))
> Is there a cleaner way of combining the expressions aa and bb to get
>
Is there a cleaner way of combining two expressions.
This example works and gives what I want
plot(1:10)
aa <- expression(alpha==.05)
bb <- expression(beta ==.80)
aabb <- expression(alpha==.05 ~ ", " ~ beta ==.80)
text(5, 10, aa)
text(5, 9, bb)
text(5, 8, aabb)
text(5,1, parse(text=paste(depa
Many thanks to Gabor Grothendieck and William Dunlap who both
solved my problem for me, right rapidly!
cheers,
Rolf Turner
##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
__
Actually that gives a "call" object. To get an expression object:
> f <- function(e1, n) as.expression(substitute(e1^n, list(e1 = e1[[1]], n =
> n[[1]])))
> out <- f(expression(x^2+y^2), expression(n)); out
expression((x^2 + y^2)^n)
> class(out)
[1] "expression"
On Fri, Sep 4, 2009 at 10:59 PM,
Use substitute:
> f <- function(e1, n) substitute(e1^n, list(e1 = e1, n = n[[1]]))
> f(expression(x^2+y^2), expression(n))
expression(x^2 + y^2)^n
On Fri, Sep 4, 2009 at 10:22 PM, Turner Rolf wrote:
>
> I am trying to construct a function to which I pass an expression as an
> argument.
> >From t
I am trying to construct a function to which I pass an expression as an
argument.
>From that expression I want to create a somewhat more complicated expression
and then differentiate it using D() or deriv().
To give a simple example, I'd like to be able to do something like
e1 <- expression(x^2
9 matches
Mail list logo