Skip to content
Back to formatted view

Raw Message

Message-ID: <4fc1d4ee8b.4ee8b4fc1d@jhsph.edu>
Date: 2002-12-13T18:20:03Z
From: Ravi Varadhan
Subject: How to get objects from a "formula" specification?

Hi:

I'd like to get the objects corresponding to the elements in a formula, 
from a data frame.  For example, suppose I would like to make a 
function call, such as follows:

myfunc(formula="y ~ x1 + x2 + log(x3)" , data=mydata)

This function will get the vector objects y, x1, x2, and log(x3) from 
the data frame "mydata" to form the design matrix and then perform a 
maximum likelihood estimation of the regression parameters.  

My questions is,  how do I get the the vector objects y, x1, x2, and 
log(x3),specified the formula, from the data frame "mydata"?

thanks for any help,
Ravi.