[R] macro facility in R

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Jul 3 14:13:46 CEST 2006

"John Sorkin" <jsorkin at grecc.umaryland.edu> writes:

> R 2.2 on windows XP

(that's a bit old...)

> I have a dataset with multiple columns. Some of the columns represent
> independent variables, some represent dependent variables. I would like
> to run the same analyses on a fixed set of independent variables,
> changing only the dependent variable, e.g.
> y1-y2=x1+x2+x3
> y3-y4=x1+x2+x3
> y5-y6=x1+x2+x3, etc.
> I know I can write a function to perform the analyses, however in order
> to make the analyses easy to do, I really need a macro scripting
> language that will allow preprocessing of the function and substitution
> of macro variables with parameters passed to the macro, i.e. I need
> someting akin to the macro facility in SAS. Is there a macro facility
> that I can use with R? I have tried help.search("macro") and did not
> have any success.
> Thanks,
> John  

Some people have indicated that they might want to try their hand and
write a macro facility for R, at some time in the future. (There are
some parts of the R internals that would benefit from such a facility

Meanwhile, update() is your friend.

mdl <- lm(y1-y2 ~ x1+x2+x3,....)
summary(update(mdl, y3 - y4 ~ .))

   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907

More information about the R-help mailing list