ant_list
is a list, data
is a parameter, how can I pass through the parameter to function in apply
, that is:
result<-lapply(ant_list,FUN,...)
how to use the parameter data
in the FUN
,
for example,
ant_list<-list(c(1,2,3,4),
c(2,3,4,5),
c(3,4,5,6))
data<-3
result<-lapply(ant_list,function(x){
result_temp<-x+data
return(result_temp)
})
It is a way to pass through the parameter as followed