From p.dalgaard@kubism.ku.dk  Mon Nov  3 18:27:53 1997
From: p.dalgaard@kubism.ku.dk (Peter Dalgaard BSA)
Date: 03 Nov 1997 19:27:53 +0100
Subject: R-alpha: expression(..) objects -- c(ex1, ex2) `fails'
In-Reply-To: Martin Maechler's message of Mon, 3 Nov 1997 18:54:13 +0100
References: <199711031754.SAA01954@sophie.ethz.ch>
Message-ID: <x2iuu9hlxy.fsf@blueberry.kubism.ku.dk>

Martin Maechler <maechler@stat.math.ethz.ch> writes:
[I've taken out the ">" citation symbols to allow cut and paste]

##-- `Simple'  length--1  expressions:
ex1 <- expression(hat(beta) == (X^t * X)^{-1} * X^t * y)
ex2 <- expression(bar(x) == sum(over(x[i], n), i==1, n))

##-- A length--2 expression:
ex12 <- expression(bar(x) == sum(over(x[i], n), i==1, n),
  hat(x) == median(x[i], i==1,n))

##please avoid TABS, Martin. It confuses readline...

> ###-> How could I take ex1, ex2 and "concat" them to an expression
> ###  of length 2 ?

#Heh. One would at least expect
l<-NULL
l[[1]]<-ex1[[1]]
l[[2]]<-ex2[[1]]
#to be a list of calls, which by definition is what an expression is,
#so you'd only need to change the mode, but:

 
mode(e)<-"expression" 
e
# expression(list(hat(beta) == (X^t * X)^{
#         -1
# } * X^t * y, bar(x) == sum(over(x[i], n), i == 1, n)))

#(Why does it deparse in that strange way, BTW?)

#Also, textual representations of length-2 expressions is acting up:
deparse(ex12)
#[1] "bar(x) == sum(over(x[i], n), i == 1, n)"
str(ex12)
# bar(x) == sum(over(x[i], n), i == 1, n)
dput(ex12)
# bar(x) == sum(over(x[i], n), i == 1, n)
deparse(ex12[[2]])
# [1] "hat(x) == median(x[i], i == 1, n)"

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


R-alpha: expression(..) objects -- c(ex1, ex2) `fails'
Peter Dalgaard BSA