On 09.02.2012 08:54, arunkumar1111 wrote:
Hi

I'm storing two functions in a list

# creating two function
   function1<- function(n) {
   return(sum(n))
}

function2<- function(n) {
   return(mean(n))
}

#storing the function
function3 =c(function1,function2)

is it possible to call the stored function and used it ?

  x=c(10,29)
funtion3[1](x)


Yes, if you correct the typo and use list indexing with double brackets:

function3[[1]](x)

Uwe Ligges



Thanks

-----
Thanks in Advance
         Arun
--
View this message in context: 
http://r.789695.n4.nabble.com/calling-the-function-which-is-stored-in-a-list-tp4372131p4372131.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

______________________________________________
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