The sys.call or match.call functions may be what you are looking for: > tmpfun <- function(x,y,z,...) { + as.list( sys.call() ) + } > > tmpfun( x=5, w=3, 1:10 ) [[1]] tmpfun
$x [1] 5 $w [1] 3 [[4]] 1:10 > tmpfun2 <- function(x,y,z,...) { + as.list( match.call() ) + } > tmpfun2( x=5, w=3, 1:10 ) [[1]] tmpfun2 $x [1] 5 $y 1:10 $w [1] 3 > -- 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-bounces@r- > project.org] On Behalf Of Jannis > Sent: Thursday, September 01, 2011 9:14 AM > To: r-help@r-project.org > Subject: [R] get arguments passed to function inside a function > > Dear list, > > > I am wondering whether there is an (easy) way to access all arguments > and their values passed to a function inside this function and (for > example) store them in a list object? > > I could imagine using ls() inside this function and then looping > through all names and assigning list entries with the values of the > respective objects but I could imagine that there is already something > ready made in R to achieve this. > > Does anybody have an idea? > > Thanks > Jannis > > > ______________________________________________ > 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.