r - Apply function over list of vectors -
i have list of vectors:
[[1]] [1] 4 2 2 5 6 5 [[2]] [1] 30 9 320 2 ... [[99]] i apply function on of vectors in list.
sapply(1:99, function(x) listofvectors[[x]], max) i error:
error in fun(1:99[[1l]], ...) : unused argument (.primitive("max")) i same error mean() or other function. doing wrong?
change code to:
sapply(1:99, function(x) max(listofvectors[[x]])) or directly use
sapply(listofvectors, max)
Comments
Post a Comment