Hi interested readers,
I have a function that creates several functions within a loop and I would like 
them to be returned for further use as follows:

Main.Function(df,...){
# df is a multivariate data
funcList<-list(NULL)

for (i in 1:ncol(df)){
temp<-logspline(df[,i],...) # logspline density estimate
funcList[[i]]<-function(x){expression(temp,x)}
}

return(funcList)
}

I have tried this, unfortunately can't figure out why all the functions 
returned are identical.

Any help towards this will be much appreciated. Thanks.

______________________________________________
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