[R] filling array with functions

From: derek <jan.kacaba_at_gmail.com>
Date: Fri, 22 Apr 2011 10:02:21 -0700 (PDT)


Hello R,

I would like to find out how to generate array full of functions. I tried it like this:

fv=array(,dim=c(1,10))
V=c(1:10)
for (i in 1:10){
fv[i]<-function(x)(V[i]-b*a*x) # b, x are constants. }

But it returns:
"incompatible types (from closure to logical) in subassignment type fix"

--
View this message in context: http://r.789695.n4.nabble.com/filling-array-with-functions-tp3468313p3468313.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.
Received on Fri 22 Apr 2011 - 17:06:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Apr 2011 - 17:40:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive