Re: [R] passing arguments to subset from a function

2008-12-17 Thread David Winsemius
Available free for the typing are the functions for the default and the dataframe methods of subset: subset.default function (x, subset, ...) { if (!is.logical(subset)) stop('subset' must be logical) x[subset !is.na(subset)] } subset.data.frame function (x, subset,

Re: [R] passing arguments to subset from a function

2008-12-17 Thread baptiste auguie
I wrote a dirty hack last time I faced this problem, I'll be curious to see what is the proper way of dealing with the scoping and evaluation rules. library(datasets) myfunction-function(table, extraction) { table2-subset(table,extraction) return(table2) } condition1 -

Re: [R] passing arguments to subset from a function

2008-12-17 Thread iverson
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.goua...@arvalisinstitutduvegetal.fr wrote: Hello R-helpers, I'm writing a long function in which I manipulate a certain number of datasets. I want the

Re: [R] passing arguments to subset from a function

2008-12-17 Thread Vitalie S.
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 (...){