[R] basic information defining functions
    Bunny, lautloscrew.com 
    bunny at lautloscrew.com
       
    Tue Nov 25 11:17:49 CET 2008
    
    
  
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
    
    
More information about the R-help
mailing list