[R] Pasting function arguments and strings

Peter Langfelder peter.langfelder at gmail.com
Wed Oct 13 18:35:47 CEST 2010


>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 <mantino84 at libero.it> wrote:
>
> 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.789695.n4.nabble.com/Pasting-function-arguments-and-strings-tp2993905p2993976.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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