hadley / r4ds

R for data science: a book
http://r4ds.hadley.nz
Other
4.51k stars 4.19k forks source link

No seed set in section 26.2 #1608

Open jcornickm opened 9 months ago

jcornickm commented 9 months ago

Since no seed is set in generating the df used in this section, the results each user will get when computing the median for each column will be different from those in the book, which might be a bit confusing. My first reaction when I saw my results didn´t match the book was to find a mistake in my code, and then I realized what was going on. You might want to considering either setting a seed before using rnorm() or warning the reader that their results will not be the same as in the book. Just a suggestion.

mine-cetinkaya-rundel commented 1 month ago

A seed is set in each chapter of the book in _common.R that is sourced on top of each chapter, but for this chapter we might want to set a specific seed at this location for readers to be able to reproduce the results.