class: center, middle, inverse, title-slide # My journey in writing books and blogging about R ###
Yihui Xie
, RStudio PBC ### 2021/07/04 @ useR! --- ## About me - Currently a software engineer at RStudio - Majored in statistics from 2002 to 2013 (Renmin University of China, and Iowa State University) - Blogging since 2005 at [yihui.org](https://yihui.org) - My R journey started in 2005 when I was undergrad - Wrote my first R package ([animation](https://yihui.org/animation/)) in 2007, and my first important package ([knitr](https://yihui.org/knitr/)) in 2012 - Published my first book in 2013 (the last year of my PhD) --- ## About me - I love programming (not an expert), mostly in R and occasionally JavaScript - I love writing even more (not expert, either) - With the two interests combined, the natural outcome is writing books and posts about programming - I also write a large amount of non-technical stuff (mainly in Chinese) - I love the state of being focused (also why I love cooking) ??? e.g., I'm learning to write fairy tales for my kids and also poems this year --- class: inverse, middle, center # Writing books --- background-image: url(https://user-images.githubusercontent.com/163582/124138837-ab39e580-da4c-11eb-8a32-0aa0ce53f65a.jpeg) background-size: contain background-position: right center Books that I have authored and co-authored --- > Also, I am kind of hoping that the sixth empty spot in this collage will be filled in by a xaringan cookbook by @xieyihui and @grrrck! > > ---[Indrajeet Patil @patilindrajeets](https://twitter.com/patilindrajeets/status/1409070366786457605) --- ## How the book journey started - Short answer: because of an awesome editor, John Kimmel (https://yihui.org/en/2021/04/john-retirement/) - First book in 2013: Dynamic Documents with R and knitr (https://yihui.org/en/2013/06/tips-for-writing-an-r-book/) .center[![1st ed of the knitr book](https://images.tandf.co.uk/common/jackets/crclarge/978148220/9781482203530.jpg)] --- ## Dynamic Documents with R and knitr - I had to document the knitr package anyway. The full documentation would be lengthy. Why not write a book? - John was interested and supportive. - As a PhD student, I was free and *fearless.* - Content: (1) Package documentation (2) Q&A from knitr mailing list and Stack Overflow (3) Software internals. - No proposal (why?). Took a few months to finish the first draft, then talked to John. --- ## The 2nd edition - The 1st edition focused on Rnw documents (R + LaTeX) - R Markdown became much more popular, therefore I updated the book and published the 2nd ed in 2015. - This is my first and only non-free book (because I had never thought of the possibility). All later books can be read online for free. --- ## The bookdown package (2016) - bookdown: an R package for writing books with R Markdown - Supports HTML, LaTeX/PDF, and EPUB output - Since it supports HTML, why not make the HTML version free? Traditionally, a book is often a PDF, and publishers have good reasons for not making the PDF free. - John convinced Chapman & Hall of the "HTML for free + PDF for sale" model. - Tips on writing a book for Chapman & Hall: https://yihui.org/en/2018/08/bookdown-crc/ --- ## The bookdown book - The bookdown book was the first attempt to see if the "HTML for free + PDF for sale" model works. - Luckily, it worked fairly well! A lot of books adopted this model: https://bookdown.org - The bookdown book is a relatively short book (only about 100 pages). You can publish a short book on a small topic! - https://bookdown.org/yihui/bookdown/ --- ## The blogdown book (2017) - Another package, another book: https://bookdown.org/yihui/blogdown/ - A big challenge of writing books: you have to make sure that the content you write is *stable* enough (e.g., won't become outdated in at least a couple of years). - Because once the book is printed, you can't update the hard copy purchased by readers. By comparison, writing blog posts is easier because you can update a post at any time. - Unfortunately, blogdown's dependency, Hugo, has not been super stable. The book is currently outdated, but I have not had a chance to update it yet. --- ## R Markdown: The Definitive Guide (2018) - The online documentation at [rmarkdown.rstudio.com](https://rmarkdown.rstudio.com) was mainly written by JJ Allaire and Garret Grolemund. - I converted it to a book. It took me about four months (https://yihui.org/en/2018/07/r-markdown-book/). - Online version: https://bookdown.org/yihui/rmarkdown/ --- ## R Markdown Cookbook (2020) - The Definitive Guide was a reference book, so it could be boring and overwhelming to read. - The cookbook was born out of 6000 Stack Overflow questions (of course, not all questions were covered). - https://bookdown.org/yihui/rmarkdown-cookbook/ --- class: inverse, middle, center ## Blogging --- ## Why blogging? David Robinson, The unreasonable effectiveness of public work, rstudio::conf 2019 https://www.rstudio.com/resources/rstudioconf-2019/the-unreasonable-effectiveness-of-public-work/ (Strongly recommended) --- ## Some personal stats | blog | year | posts | words | characters | |:-----|-----:|------:|------:|------:| | English: [yihui.org/en/](https://yihui.org/en/) | 2007 - 2021 | 345 | 194,627 | 1,249,763 | | Chinese: [yihui.org/cn/](https://yihui.org/cn/) | 2005 - 2021 | 1260 | | 3,449,609 | --- ## Some personal experience - The website theme is often the most important thing to beginners (https://bookdown.org/yihui/blogdown/other-themes.html), which is totally understandable, but I don't care much about it any more. I don't mean you should be a minimalist, too. I did use fancy themes in early years. - More often than not, I see people spend a lot of time on choosing a gorgeous theme but not stick to writing much content later. - It's tempting to change the theme, and I'd recommend that you write ~30 posts before considering the theme. --- ## Some personal experience - Consider enabling comments (if your website is still young, consider using [Utterances](https://utteranc.es)). - On your "Home" or "About" page, don't forget to write down your name (unless you want to remain anonymous). - Consider providing a page that shows the *full* list of post titles. The common practice is to paginate the list. Personally I don't like that---I always want to see *everything* you have written (all post titles on one page). - Similarly, consider providing navigation links to the previous/next post on the current page. --- ## Writing is a long-term investment - The reward can come slowly but also steadily. You will be amazed by the compound interest in the (far) future. - Don't worry if your writing looks silly in the beginning. If you do, please feel free to read my older blog posts, and have a good laugh at that idiot. --- background-image: url(https://user-images.githubusercontent.com/163582/124141564-20a6b580-da4f-11eb-845e-c3d754a18eee.jpeg) background-size: contain background-position: right center A book that I started writing in 2007 but never finished or published until this month (2021)! Be patient and persistent. Your effort won't be easily wasted. --- > Love like you've never been hurt Dance like nobody's watching Sing like nobody's listening Work like you don't need the money Live like it's heaven on earth > > ---Alfred D’Souza -- > Write like nobody's reading > > ---Yihui ??? This is for beginners. If you write a book, of course you have to consider your readers. --- class: center, middle # Thank you! ## Slides: https://slides.yihui.org/2021-useR-journey.html