[R] passing arguments to subset from a function
iverson
iverson at biostat.wisc.edu
Wed Dec 17 20:55:41 CET 2008
This thread may help?
https://stat.ethz.ch/pipermail/r-help/2007-November/145345.html
On Wed, 17 Dec 2008 20:07:08 +0100, "GOUACHE David"
<D.GOUACHE at arvalisinstitutduvegetal.fr> wrote:
> Hello R-helpers,
>
> I'm writing a long function in which I manipulate a certain number of
> datasets. I want the arguments of said function to allow me to adapt the
> way I do this. Among other things, I want my function to have an argument
> which I will pass on to subset() somewhere inside my function. Here is a
> quick and simplified example with the iris dataset.
>
> myfunction<-function(table, extraction) {
> table2<-subset(table, extraction)
> return(table2) }
>
> myfunction(iris, extraction= Species=="setosa")
>
>
> ############## end
>
> What I would like is for this function to return exactly the same thing
as
> :
> subset(iris, Species=="setosa")
>
>
> Thanks for your help.
>
> Regards,
>
> David Gouache
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list