moderndive / ModernDive_book

Statistical Inference via Data Science: A ModernDive into R and the Tidyverse
https://www.moderndive.com/
Other
759 stars 491 forks source link

Update 06-multiple-regression.Rmd #504

Closed e-clin closed 4 months ago

e-clin commented 4 months ago

Updated hard-coded skimr::skim() outputs in Sections 6.1.1 and 6.2.1 for skim v2.1.5.

ismayc commented 4 months ago

Thanks, @e-clin! Have you figured out a way not to have this hard-coded? In other words, the appropriate arguments to skimr::skim() to get the right output? Thanks again!

e-clin commented 4 months ago

Thanks, @ismayc for approving my PR. :)

I wasn't sure what the original problem was when I read the book, so I didn't disable the eval=FALSE chunk option. Now that you mentioned it, I noticed some comments at the beginning of this Rmd referring to this issue where a reader reported the variable statistics not being shown in the skimr::skim() output.

I therefore allowed evaluation of the code chunk and removed the hard-coded skimr::skim() output in a local copy of the Rmd file. The skimr::skim() output seems to be correct in the knitted HTML as shown in the screenshot of Section 6.1.1 below:

image

This was based on skimr v1.0.6 (as you asked in the issue above), tidyverse v2.0.0, rmarkdown v2.27 and knitr v1.47 on R 4.4.1.

Before I downgraded skimr to v1.0.6, I had singled out the code chunk for HTML output on skimr v2.1.5, and the result also seemed fine to me. Did I miss anything?

ismayc commented 4 months ago

Thanks for your help with this! Our original issue was that the inline histograms did not show correctly in bookdown files after being built. The kable function also wouldn't work for a lot of tables going forward after using skimr::skim(). We couldn't figure out the right way to get both of those issues to go away when building the book as a webpage.

e-clin commented 4 months ago

Thanks for the additional info. I had a very similar, if not the same, problem in 2020 - the mini-histograms from skimr::skim() were incorrectly displayed as random symbols on the webpage rendered from an Rmd file. I therefore had to disable them as illustrated in this book. My test today on the single Chapter 6 Rmd file seems promising - maybe it has been resolved?

ismayc commented 4 months ago

It looks like the default output for skimr::skim() still doesn't allow for scrolling horizontally and it cuts off the p100 values in bookdown so even all these years later it's still not working. We'll just leave in the hard-coded values, but updated to use the {skimr} v2 syntax.

ismayc commented 4 months ago

This PR and the chapter 5 are going to be incorporated in an update to the book that we are doing right now for the Second Edition. Thanks again!