Wacek Kusnierczyk <waclaw.marcin.kusnierc...@idi.ntnu.no> wrote >> Seriously? You think: >> >> lapply(1:n, rnorm, 0, 1) >> >> is 'clearer' than: >> >> x=list() >> for(i in 1:n){ >> x[[i]]=rnorm(i,0,1) >> } >> >> for beginners? >> >> Firstly, using 'lapply' introduces a function (lapply) that doesn't >> have an intuitive name. Also, it takes a function as an argument. The >> concept of having a function as a parameter to another function is >> something that a lot of programming beginners have trouble with - >> unless they were brought up on LISP of course, and few of us are. >> >> I propose that the for-loop example is clearer to a larger population >> than the lapply version. >
As a beginner, I agree .... the for loop is much clearer to me. Peter Peter L. Flom, PhD Statistical Consultant www DOT peterflomconsulting DOT com ______________________________________________ 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.