On Wed, 17 Dec 2008 20:07:08 +0100, GOUACHE David 
<d.goua...@arvalisinstitutduvegetal.fr> wrote:
argument which I will pass on to subset() somewhere inside my function.


I would use the example of .() function from plyr package in this case:

.<-function (...){
    structure(as.list(match.call()[-1]), class = "quoted")
}

myfunction<-function(table, extraction)  {
    table2<-subset(table, eval(extraction[[1]]))
    return(table2)
}
myfunction(iris, extraction = .(Species=="setosa"))

You can pass as many arguments in .() as you wish and index correspondingly in 
myfunction afterwards.

HTH.

______________________________________________
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.

Reply via email to