Also look at the get function, it may be a bit more straight forward (and safer if there is any risk of someone specifying 'rm(ls())' as a data frame name).
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of darckeen > Sent: Thursday, October 14, 2010 11:53 PM > To: r-help@r-project.org > Subject: Re: [R] specify data frame by name > > > nvm, i figured it out. > > > dfm <- data.frame(x=1:10) > > testfunc <- function(data="dfm") > { > dat <- eval.parent(as.symbol(data)) > sum(dat$x) > } > > print(testfunc()) > > -- > View this message in context: http://r.789695.n4.nabble.com/specify- > data-frame-by-name-tp2996534p2996541.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.