Hi all,

i am looking from some insights to define own R functions. so far i found most basics in documentations that are around on the web. except for one thing:

I´d like to define some function, say:

#assume my data matrix contains vectors like data$myColumn1,data $myColumn2 etc.

getMyColumn <- function (columnid){

x<-data$MyColumn?columnid?[data$indexone=1 & data$index2=5]

return(x)

}

Do I need to use assign or eval first ? I tried to use paste to combine something like: paste("data$MyColumn",columnid,sep="") which did not work.

I am happy to get any help with the problem, but also thankful for some useful link or guide on how to define own functions properly, especially the dynamic naming and return part

thx in advance

bunny

______________________________________________
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