Tag: looping

Example 9.29: the perils of for loops

A recent exchange on the R-sig-teaching list featured a discussion of how best to teach new students R. The initial post included an exercise to write a function, that given a n, will draw n rows of a triangle made up of “*”, noting that for a beginne…

Example 9.19: Demonstrating the central limit theorem

A colleague recently asked “why should the average get closer to the mean when we increase the sample size?” We should interpret this question as asking why the standard error of the mean gets smaller as n increases. The central limit theorem shows t…