[Rd] formulas and frames

Gabor Grothendieck ggrothendieck at gmail.com
Sun Apr 3 03:10:59 CEST 2005


On Apr 2, 2005 3:35 PM, Charles Geyer <charlie at stat.umn.edu> wrote:
> On Fri, Apr 01, 2005 at 05:04:23PM +0200, Dimitris Rizopoulos wrote:
> > if I understand well you want something like this:
> >
> > y <- rnorm(100)
> > p <- rnorm(100)
> > x1 <- rnorm(100)
> > x2 <- rnorm(100)
> > x3 <- rnorm(100)
> > nams <- c("y", "p", paste("x", 1:3, sep=""))
> > ##############
> > dat <- as.data.frame(lapply(nams, get))
> > names(dat) <- nams
> > dat
> >
> > I hope it helps.
> 
> Yes, that's it.  Thanks.

With that, maybe you could use a notation like this
where the predecessor variables are after the bar:

	fo <- cbind(a, b) ~ c + I(c^2)*f | d + e

	all.vars(fo) # all variables 
	all.vars(fo[[2]]) # response variables
	all.vars(fo[[3]][[2]]) # explanatory variables
	all.vars(fo[[3]][[3]]) # predecessor variables



More information about the R-devel mailing list