[R] building lme call via call()

2010-10-25 Thread Vito Muggeo (UniPa)

dear all,
I would like to get the lme call without fitting the relevant model.

library(nlme)
data(Orthodont)
fm1 - lme(distance ~ age, random=list(Subject=~age),data = Orthodont)

To get fm1$call without fitting the model I use call():

my.cc-call(lme.formula, fixed= distance ~ age, random = list(Subject 
= ~age))


However the two calls are not the same (apart from the data argument I 
am not interested in), as call() *does* evaluate the arguments:


 my.cc$random
$Subject
~age

 fm1$call$random
list(Subject = ~age)

How is it possible to get the right call (similar to the one from 
fm1$call) by means of call()?


thanks,
vito



--

Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 23895240
fax: 091 485726/485612
http://dssm.unipa.it/vmuggeo

__
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 commented, minimal, self-contained, reproducible code.


Re: [R] building lme call via call()

2010-10-25 Thread William Dunlap


Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Vito Muggeo (UniPa)
 Sent: Monday, October 25, 2010 9:16 AM
 To: r-h...@stat.math.ethz.ch
 Subject: [R] building lme call via call()
 
 dear all,
 I would like to get the lme call without fitting the relevant model.
 
 library(nlme)
 data(Orthodont)
 fm1 - lme(distance ~ age, random=list(Subject=~age),data = Orthodont)
 
 To get fm1$call without fitting the model I use call():
 
 my.cc-call(lme.formula, fixed= distance ~ age, random = 
 list(Subject 
 = ~age))
 
 However the two calls are not the same (apart from the data 
 argument I 
 am not interested in), as call() *does* evaluate the arguments:
 
   my.cc$random
 $Subject
 ~age

You can use quote() to avoid the evaluations.  E.g.,
   better.cc - call(lme.formula,
  +   fixed=quote(distance~age),
  +   data=quote(Orthodont),
  +   random=quote(list(Subject=~age)))
   identical(better.cc, fm1$call)
  [1] TRUE

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

 
   fm1$call$random
 list(Subject = ~age)
 
 How is it possible to get the right call (similar to the one from 
 fm1$call) by means of call()?
 
 thanks,
 vito
 
 
 
 -- 
 
 Vito M.R. Muggeo
 Dip.to Sc Statist e Matem `Vianelli'
 Università di Palermo
 viale delle Scienze, edificio 13
 90128 Palermo - ITALY
 tel: 091 23895240
 fax: 091 485726/485612
 http://dssm.unipa.it/vmuggeo
 
 __
 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 commented, minimal, self-contained, reproducible code.
 

__
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 commented, minimal, self-contained, reproducible code.