I need lapply to pass (to a function) values stored in a vector, successively.
values <- c(10,11,13,10) lapply(foo,function(x) peakabif(x,npeaks=values))
You want to use mapply for this: mapply(peakabif, x=foo, npeaks=values)
mapply
mapply(peakabif, x=foo, npeaks=values)