Dear all, I am having a problem with mapply. I guess the reason is that mapply is not "vectorized". But could you please take a look at my code below and help me to find a solution (either a better way to use mapply or a different function to call). Thanks a lot!
##beginning of my code myfun <- function(threshold, all.data) { ##Just a demostration of a function that takes a dataframe. #browser() #print(all.data) return (min(subset(all.data, id > threshold)$val)) } my.data = data.frame(id = (1:10), val = (-3:6)) print(myfun(2, my.data)) ##Everything works up to here. result = mapply(myfun, (2:4), rep(my.data, 3)) ##got trouble here. ##More specifically, the all.data inside myfun is no longer a dataframe. [[alternative HTML version deleted]] ______________________________________________ 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.