Closed juliasilge closed 8 years ago
I think we should show the code for at least some plots, since I do think the ease of visualization with ggplot2 is a major benefit for the tidy text workflow. (It's something that can't be done directly from other packages)
But two ways we can reduce it:
Yeah, maybe we can use this to make consistently themed plots in the whole book, actually. Just define/hide some nice theme customization for the whole thing.
Another question: we can put
new_session: yes
at the beginning of _bookdown.yml
if we want, and that forces each .Rmd to be self-contained, I think? Then in each chapter, we would need to repeat each library(tidytext)
and so forth, and also right now in the first few chapters there are dependencies on the actual data frames themselves (tidy_books
, etc).
On the one hand, things might get repetitive. On the other hand, if the point is to be helpful and tutorial-like, it seems rather unhelpful to send people searching back through past chapters to find out where something was defined. I lean toward setting the new session variable to yes?
I think that's a good idea but it means we'd have to define the aforementioned ggplot2 theme each time- even if hidden that's a lot of duplication. Perhaps we should have a setup.R
that defines that, and gets called in a hidden chunk at the start of each chapter.
I think it also currently requires chunk names to be unique even among chapters, which is annoying, so if this fixes that it would be great.
Title or sentence case for chapter and section headings? I don't have a preference but we need to be consistent and the sooner we start editing these things the more likely we are to get them all right.
(Also, I don't think we need to go lower than section headings; I think we should change everything to ##
that is currently ###
.)
OK, few suggested conventions, please let me know if you disagree:
%>%
I'm not sure about ###
. I think I do find subsections useful and other books like R4DS use them (see here); and we may find that there are too many sections in the table of contents otherwise
These all sound good to me. I've already started giving chunks names as I edit; I'll keep going with that.
I used to use four spaces (broom package is an artifact of that time) but moved to two about 1.5 years ago. I've been surprised at how readable it is, and it does help avoid hitting 80 chars!
My best argument is that I think we otherwise follow all of Hadley's style guide and this would get us to 100% 😀
We might want to go through and change all the factor handling to use forcats functions; they are much nicer.
A couple of thoughts/questions...
theme_set
in everything to be the same, but in case I didn't, I am liking how theme_light
looks, and I think we can just go with the default ggplot2 colors. I don't think it's at all a problem in this context that the plots are super obviously made by ggplot2.
I'm hoping that we can use this issue for questions about consistency in style for the whole book.
My first one: should we show or hide code to make plots in the book? I show the code on my blog because I know some people are interested specifically in that and always ask questions, but I lean toward hiding in the book, since it is not about plotting at all. Thoughts?