[R] R Help-Implicit loop-lapply

arun smartpink111 at yahoo.com
Mon Oct 14 19:35:41 CEST 2013


Hi,The conditions are not very clear.
set.seed(285)
 RN <- sample(1:100,20,replace=FALSE)
aList <- lapply(1:10,function(i) sample(RN,i,replace=FALSE)) 
 sapply(aList,tail,1)
# [1] 87 60 96 87 60 67 42 96 73 24

A.K.




I was wondering if I could obtain some help on how to do this. 



I feel as if I'm supposed to use the vector that i made with sample in order to use this function 

I've been trying 

aList <- lapply(1:10, RN) of course it doesn't work.



More information about the R-help mailing list