[Rd] formulas and frames

Charles Geyer charlie at stat.umn.edu
Fri Apr 1 09:31:51 CEST 2005


I have a design problem.  I'm trying to design a package that does
something like glm, but

  1. the response is multivariate, so I can't be just like glm
     and get the response variables out of the formula.  I decided
     (perhaps incorrectly) to just supply the response variable
     names as an argument "response".

  2. I have the usual predictor variables.

  3. I discovered the reshape function, which will allow me to
     string out the data frame in long form with the response
     strung out in a single vector.  So I can get a model matrix
     for the right hand side of the formula, which can also include
     what reshape calls the time variable (although it isn't time).

so far so good, but

  4. Each response variable is conditioned on a "predecessor" variable.

so we come to my question.  How do I force a bunch of variables into
a data frame?  I need all of the "response" and "predecessor" variables,
which are at this point specified only by a character vector containing
their names (or something else???) and I also need all of the predictor
variables.  If the user has supplied a data frame containing all that
stuff fine!  But if it's just all over the place, some in the "data"
argument and some in the R global environment (or elsewhere???).
Maybe I'm just ignorant, but I haven't stumbled across a function that
just stuffs all that stuff into a data frame (model.frame would do it
if I didn't have this extra stuff).

Any help?  Or do I just have to kludge this?

-- 
Charles Geyer
Professor, School of Statistics
University of Minnesota
charlie at stat.umn.edu



More information about the R-devel mailing list