unction(x) "the p test"
> f("m", 17)
[1] "the m test"
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Manta
> Sent: We
>From what I read, you want something like this:
myfunction<-function(dataset,arg1,arg2)
{
func = match.fun(arg2)
argument = dataset[, match(paste(arg1,"_test", sep=""), names(dataset))]
result=func(argument)
return(result)
}
On Wed, Oct 13, 2010 at 9:28 AM, Manta wrote:
>
> Thaks for your q
Thaks for your quick reply Bert, although I doubt it works.
The reason is that the names of the objects of the dataset, all end with the
sufix '_test' and therefore I need to attach/paste/glue this suffix to the
'arg2' of the function. Any other idea?
--
View this message in context:
http://r.7
If I understand you correctly, just arg2(arg1) will work fine...One of
the nice features of R.
Example:
f <- function(dat,fun=mean,...)
{
fun(dat, ...) ## ... allows extra arguments to fun
}
f( rnorm(10), trim=.05) ## trimmed mean
x <- 1:10
f(x, fun = max,na.rm=TRUE)
Cheers,
Bert
On Wed,
4 matches
Mail list logo