Bookdown Pdf

Posted on  by admin

PDF (Portable Document Format) merupakan berkas dalam sebuah format yang diembangkan oleh Adobe System untuk.

Quindi voglio inserire una tabella E un'immagine in R Markdown. In un normale documento word posso inserire facilmente una tabella (5 righe per 2 colonne) e per l'immagine basta copiare e incollare. 8 Basic plotting with ggplot Lecture Notes: Introduction to Data Science. Compare this file to wordpdfwriter.pdf and winedt.pdf and note that Scientific Notebook uses the Arial font for text by default.

Hello World!

tl;dr: A list of useful resources aimed to self-publish a book on Amazon using Bookdown.

  • Writing style
  • Did I use any editor?
  • Marketing
  • How to create the book: Bookdown!
  • Self-publishing on Amazon (Kindle and paperback)
  • Costs and earnings
  • Publishing outside Amazon: Gumroad
  • Proofreading
  • Cover
  • ISBN
  • Linking: B&W, color and Kindle on Amazon
  • 11-tips to write good

Update Ago-28-2018: I published another blog post related to this one, which contains more technical aspects of Bookdown.

Update Nov-13-2018: The two 'how-to' posts won the first place in the 1st Bookdown Contest by RStudio 😃


A friend of mine told me to write down all the details about self-publishing a book.
So here you go—a long post explaining almost all the things I have done and discovered.

First of all, my thanks go to Bookdown. This R package allows enthusiastic people to self-publish a book! Although the book is based on R language, this process can be applied to any kind of book.

Kaylen Sanders from did a poetic review of it.

The end

The two-year journey culminated with two paperback versions available on Amazon (Color and B&W), a Kindle version, an epub version, a PDF, and a website.

The start

I didn't plan to write a book. Around six years ago, I started using R and, as with many programmers, my 'personal' library with many shortcuts began to grow.

Then I thought that this library could help more people, so after arranging lots of things in the right place, I published the 'funModeling' package on CRAN in February 2016.

Google and the book R Packages from Hadley Wickham (April 2015) were incredibly useful. Don't hesitate to check out that book if you plan to write a package.

I deeply believe that when there is an explanation behind what we use and what we do, it changes the way we perceive the action. So, I started to document the funModeling package functions.

The documentation grew rapidly, and soon escaped from the original scope of the package to include general explanations of machine learning and data preparation, and then the first version of the book was born!

Two months after the release, I rewrote everything from scratch.

There are two key points here:

  1. We don’t always we have a clear goal—we just 'walk' and that goal takes shape.
  2. The first version is not always the ultimate one; start now with the ideas you already have and let them grow.

Writing style

I wanted to 'write everything I know'—things that took me a lot of time to learn—and expose the concepts with examples, lots of examples, so the reader can check them and extract their own conclusions.

The other remarkable point was on 'how to interpret all the results.” I found that when someone explains the analytical thinking path, extracting different conclusions from the analysis; then the undersanding around the topic is boosted.

These two books are aligned with the last idea:

Data Mining: Concepts and Techniques 3rd Edition by Jiawei Han, Micheline Kamber and Jian Pei (2012)

Data Mining with R: Learning with Case Studies by Luís Torgo (2011)

Note: Data Science = Data Mining + some marketing ;) Nowadays: Data Mining = web scraping

Did I use any editor?

Nope, you can 100% self-publish a book on your own, with patience and the Amazon self-publishing service.

Editors can help in the book structure, proofreading, marketing, printing, and distribution among others. It saves time.


A friend of mine surprised me with a Facebook ad campaign for the book when I launched it. Except from that, all marketing was done by word-of-mouth and some posts in the Data Science Heroes Blog.

Would you share it? ;)

How to create the book: Bookdown!

This amazing R package provides all the processes to create Kindle and paperback editions.

Get started with the minimum reproducible example at:


The Data Science Live Book was 100% done using R and RStudio.

Only Bookdown should be a BIG point in any 'Why R?' list.

You should google all of these terms before starting: Latex, Yaml, Knitr, R markdown, Pandoc, GitBook. None of them are Pokémon.

Recommended lecture: Relationship between R Markdown, Knitr, Pandoc, and Bookdown.

Check the RStudio lessons on what is R Markdown:

Self-publishing on Amazon

Amazon runs a program called Kindle Direct Publishing (KDP).

Publishing the paperback version

You upload the PDF and Amazon will print on demand. That's it. You don't have to invest any money to buy so many copies before the release. After you publish, if one person from the Antartida buys a copy, then it is printed and delivered.

There are other print-on-demand publishers, like

I chose to have both versions: Black & White and Color.

The quality is excellent in both, but the color one is stunning! I see how colors help us to understand. However, the printing costs are around four times higher for this version.

Amazon will check several layout points before approving the release.

Check the color version:

And one from the black and white:

Note the quality of the plots and code layout —pretty important in a programming book.

Publishing the Kindle version

Easier to publish than the paperback.

The Kindle version of the Data Science Live Book, here!

(Amazon is incredibly vast, from printing-publishing books to host deep learning processes in AWS. Someday, Amazon and Google will be countries.)

You won't become rich publishing books unless you have a catchy title, like 'Fifty Shades of Data in Grey.'

Costs and earnings


There are two royalty options: 35% or 70%. We always want the higher, right? Well, in the 70% range, the book price must be US$9.99 at the most.

More info:



Printing costs depend on several factors. On this page, you will find how costs/royalties are calculated as well as a 'Printing cost calculator' excel file:

Amazon royalties are around 40% of retail price.

Typically, royalties when using a publisher are around 8–12% of the retail price. Source here.

Having a publisher/editor may facilitate several of things, so don't opt out only because of the earnings.

Publishing outside Amazon: Gumroad

Gumroad is a service that allows users to sell different types of files across the internet, e.g., music, videos, and data science books.

Gumroad provides a shopping cart and, after payment, the buyer automatically receives an email with the download link. It works really well! No one complains about the service. The pricing is affordable: 'If you use the Free version of Gumroad, our fee is just 8.5% + 30 cents per transaction. If you get the Premium version of Gumroad for $10 (USD)/month, our fee is 3.5% + 30 cents per sale.'

I started with the free version and then changed to premium.

One of the most useful features is that they allow embedding the payment form into your website. You can check mine here.

The other useful feature is name your price. The minimum price to download the Data Science Live Book is US$5 and the buyer gets all three versions: PDF, .mobi, and .epub.

While I was writing this post, I saw that 37% of buyers spent more than the minimum—I'm happy you like the project!

This is a list of unique buyers’ countries that bought using Gumroad—so it works worldwide.

Did you find the outlier? :P


Try always to share the book before its release.
Proofreading is needed at two levels: technical and grammatical.

Regarding the technical aspects, the proofreading was mainly done by Pablo Seibelt, Head of Data in Auth0. I have also made some changes based on people’s feedback. (Thanks!).

Regarding the grammar check, I hired several English teachers, to finally keep with one outstanding freelancer, Dr. Candy Pettus, from (a site to hire freelancers).

Because my native language is Spanish (Hola!), I also use tools like Grammarly and DeepL (which works better than Google Translate).


The tree was generated by an iterative and short algorithm.
Representing that simplicity is the seed of complexity.
Like fractals.
Like the Lorenz Attractor.
And like nature itself...

Then, the designer, Barbara Muños, took the little tree and made the magic!

And, yes, the curve on the top follows the Fibonacci ratio, a feature present in flowers, art, the human body, and 'a big etc.'

There are plenty of cover designers on


The International Standard Book Number (ISBN) is a unique numeric commercial book identifier. Publishers purchase an ISBN from an affiliate of the International ISBN Agency.

You will need an ISBN for each book version. In my case, I bought three: one for each of the Kindle, B&W, and color versions. Note: the content is the same in all three.

Amazon can provide you with a 'free' ISBN if you sell the book only with them. If you want to sell in other markets, then you will have to get outside of Amazon.


'An imprint of a publisher is a trade name under which it publishes a work' Source: Wikipedia.

The imprint is defined when you register your ISBN. Being a self-publisher means that you can pick your imprint name (it can be your real name or a fictitious one).

If you self-publish and you bought an ISBN outside the US, then you have to let know that you effectively own the ISBN you are uploading. Contact them by email for more information.

Disclaimer: I'm not an expert on the ISBN or imprint name, therefore, what applies in my case may not in yours.

Linking: B&W, color and Kindle on Amazon

If you are selling these three versions, you might except to have all of them linked. You will need to contact Amazon support to do this, because they only support one paperback linked to a kindle. Yet, the final result si some annoying...

Where 'Paperback' links to B&W version and 'Paperback, March 27, 2018' links to color version (🧟‍♂️).

Ask for adding the legend 'Color' and 'B&W' at the end of each title.

How to write good

Bookdown To Pdf

  1. Memes

Next post

I prepared a list of issues and Bookdown configurations to keep in mind that took me lot of time to find. Hopefully, it will save you time:

Final words

Is it possible to self-publish a book? Yes, definitely!

Some links:

  • Github
  • Web version:
  • Amazon B&W:
  • Amazon Color:

I found this post useful on this topic: Writing an R book and self-publishing it in Amazon by Marcelo Perlin.

I will leave you with the back of the Data Science Live Book:

Thanks for reading! :)

Write HTML, PDF, ePub, and Kindle books with R Markdown

The bookdown package is an open-source R package that facilitates writing books and long-form articles/reports with R Markdown. Features include:

Bookdown Pdf Template

  • Generate printer-ready books and ebooks from R Markdown documents.
  • A markup language easier to learn than LaTeX, and to write elements such as section headers, lists, quotes, figures, tables, and citations.
  • Multiple choices of output formats: PDF, LaTeX, HTML, EPUB, and Word.
  • Possibility of including dynamic graphics and interactive applications (HTML widgets and Shiny apps).
  • Support a wide range of languages: R, C/C++, Python, Fortran, Julia, Shell scripts, and SQL, etc.
  • LaTeX equations, theorems, and proofs work for all output formats.
  • Can be published to GitHub,, and any web servers.
  • Integrated with the RStudio IDE.
  • One-click publishing to

Below is a list of featured books. For a full list, please see the archive page. For the full documentation of the bookdown package, please see the free online bookbookdown: Authoring Books and Technical Documents with R Markdown.

This cookbook contains more than 150 recipes to help scientists, engineers, programmers, and data analysts generate high-quality graphs quickly—without having to comb through all the details of R’s graphing systems. Each recipe tackles a specific problem with a solution you can apply to your own project and includes a discussion of how and why the recipe works. […] Welcome to the R Graphics Cookbook, a practical guide that provides more than 150 recipes to help you generate high-quality graphs quickly, without having to comb through all the details of R’s graphing systems. Each recipe … Read more →


A guide to authoring books with R Markdown, including how to generate figures and tables, and insert cross-references, citations, HTML widgets, and Shiny apps in R Markdown. The book can be exported to HTML, PDF, and e-books (e.g. EPUB). The book style is customizable. You can easily write and preview the book in RStudio IDE or other editors, and host the book wherever you want (e.g. Read more →


This book introduces concepts and skills that can help you tackle real-world data analysis challenges. It covers concepts from probability, statistical inference, linear regression and machine learning and helps you develop skills such as R programming, data wrangling with dplyr, data visualization with ggplot2, file organization with UNIX/Linux shell, version control with GitHub, and reproducible document preparation with R markdown. Read more →


The first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards, interactive applications, books, dissertations, websites, and journal articles, while enjoying the simplicity of Markdown and the great power of R and other languages. Read more →

4Bookdown Pdf

Geocomputation with R is for people who want to analyze, visualize and model geographic data with open source software. It is based on R, a statistical programming language that has powerful data processing, visualization, and geospatial capabilities. The book equips you with the knowledge and skills to tackle a wide range of issues manifested in geographic data, including those with scientific, societal, and environmental implications. This book will interest people from many backgrounds, especially Geographic Information Systems (GIS) users interested in applying their domain-specific knowledge in a powerful open source language for data science, and R users interested in extending their skills to handle spatial data. Read more →


This is the website for Text Mining with R! Visit the GitHub repository for this site, find the book at O’Reilly, or buy it on Amazon. This work by Julia Silge and David Robinson is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States … Read more →


A book about engineering shiny application that will later be sent to production. This book cover project management, structuring your project, building a solid testing suite, and optimizing your codebase. We describe in this book a specific workflow: design, prototype, build, strengthen and deploy. […] This book will soon be available in print, published in the R Series by Chapman & Hall. This book will not get you started with {shiny}, nor talk how to work with {shiny} once it is sent to production. What we will be discussing in this book is the process of building an application that … Read more →

7Bookdown pdf output

A guide to creating websites with R Markdown and the R package blogdown. […] A note from the authors: Some of the information and instructions in this book are now out of date because of changes to Hugo and the blogdown package. If you have suggestions for improving this book, please file an issue in our GitHub repository. Thanks for your patience while we work to update the book, and please stay tuned for the revised version! In the meantime, you can find an introduction to the changes and new features in the v1.0 release blog post and this “Up & running with blogdown in 2021” blog post. … Read more →

Bookdown Pdf


Efficient R Programming is about increasing the amount of work you can do with R in a given amount of time. It’s about both computational and programmer efficiency. […] This is the online version of the O’Reilly book: Efficient R programming. Pull requests and general comments are welcome. Get a hard copy from: Amazon (UK), Amazon (USA), O’Reilly Colin Gillespie is Senior Lecturer (Associate Professor) at Newcastle University, UK. He is an Executive Editor of the R Journal, with research interests including high performance statistical computing and Bayesian statistics. Colin founded the … Read more →


An open-source and fully-reproducible electronic textbook for teaching statistical inference using tidyverse data science tools. […] This is the website for Statistical Inference via Data Science: A ModernDive into R and the Tidyverse! Visit the GitHub repository for this site and find the book on Amazon. You can also purchase it at CRC Press using promo code ADC21 for a discounted price. This work by Chester Ismay and Albert Y. Kim is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International … Read more →


An applied textbook on generalized linear models and multilevel models for advanced undergraduates, featuring many real, unique data sets. It is intended to be accessible to undergraduate students who have successfully completed a regression course. Even though there is no mathematical prerequisite, we still introduce fairly sophisticated topics such as likelihood theory, zero-inflated Poisson, and parametric bootstrapping in an intuitive and applied manner. We believe strongly in case studies featuring real data and real research questions; thus, most of the data in the textbook arises from collaborative research conducted by the authors and their students, or from student projects. Our goal is that, after working through this material, students will develop an expanded toolkit and a greater appreciation for the wider world of data and statistical modeling. Read more →


This is the website for Data Science at the Command Line, published by O’Reilly October 2014 First Edition. This hands-on guide demonstrates how the flexibility of the command line can help you become a more efficient and productive data scientist. You’ll learn how to combine small, yet powerful, command-line tools to quickly obtain, scrub, explore, and model your data. To get you started—whether you’re on Windows, macOS, or Linux—author Jeroen Janssens has developed a Docker image packed with over 80 command-line tools. Discover why the command line is an agile, scalable, and extensible … Read more →


This book showcases short, practical examples of lesser-known tips and tricks to helps users get the most out of these tools. After reading this book, you will understand how R Markdown documents are transformed from plain text and how you may customize nearly every step of this processing. For example, you will learn how to dynamically create content from R code, reference code in other documents or chunks, control the formatting with customer templates, fine-tune how your code is processed, and incorporate multiple languages into your analysis. Read more →


The R programming language has become the de facto programming language for data science. Its flexibility, power, sophistication, and expressiveness have made it an invaluable tool for data scientists around the world. This book is about the fundamentals of R programming. You will get started with the basics of the language, learn how to manipulate datasets, how to write functions, and how to debug and optimize code. With the fundamentals provided in this book, you will have a solid foundation on which to build your data science toolbox. Read more →


This is the website for 2nd edition of “Advanced R”, a book in Chapman & Hall’s R Series. The book is designed primarily for R users who want to improve their programming skills and understanding of the language. It should also be useful for programmers coming to R from other languages, as help you to understand why R works the way it does. If you’re looking for the 1st edition, you can find it at This work, as a whole, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. The code contained in this book is simultaneously … Read more →


An intuitive and practical approach to data analysis, data preparation and machine learning, suitable for all ages! […] This book is now available at Amazon. Check it out! 📗 🚀. Link to the black & white version, also available on full-color. It can be shipped to over 100 countries. 🌎 The book will facilitate the understanding of common issues when data analysis and machine learning are done. Building a predictive model is as difficult as one line of R code: That’s it. But, data has its dirtiness in practice. We need to sculp it, just like an artist does, to expose its information in order … Read more →


A practical introduction. […] Published by Princeton University Press. Incomplete draft. This version: 2018-04-25. You should look at your data. Graphs and charts let you explore and learn about the structure of the information you collect. Good data visualizations also make it easier to communicate your ideas and findings to other people. Beyond that, producing effective plots from your own data is the best way to develop a good eye for reading and understanding graphs—good and bad—made by others, whether presented in research articles, business slide decks, public policy advocacy, or … Read more →


This is the second edition of Forecasting: Principles & Practice, which uses the forecast package in R. The third edition, which uses the fable package, is also available. Welcome to our online textbook on forecasting. This textbook is intended to provide a comprehensive introduction to forecasting methods and to present enough information about each method for readers to be able to use them sensibly. We don’t attempt to give a thorough discussion of the theoretical details behind each method, although the references at the end of each chapter will fill in many of those details. The book is … Read more →


A guide to making visualizations that accurately reflect the data, tell a story, and look professional. […] This is the website for the book “Fundamentals of Data Visualization,” published by O’Reilly Media, Inc. The website contains the complete author manuscript before final copy-editing and other quality control. If you would like to order an official hardcopy or ebook, you can do so at various resellers, including Amazon, Barnes and Noble, Google Play, or Powells. The book is meant as a guide to making visualizations that accurately reflect the data, tell a story, and look professional. … Read more →


This book will teach you how to program in R, with hands-on examples. I wrote it for non-programmers to provide a friendly introduction to the R language. You’ll learn how to load data, assemble and disassemble data objects, navigate R’s environment system, write your own functions, and use all of R’s programming tools. Throughout the book, you’ll use your newfound skills to solve practical data science problems. Read more →


This is the website for “R for Data Science”. This book will teach you how to do data science with R: You’ll learn how to get your data into R, get it into the most useful structure, transform it, visualise it and model it. In this book, you will find a practicum of skills for data science. Just as a chemist learns how to clean test tubes and stock a lab, you’ll learn how to clean data and draw plots—and many other things besides. These are the skills that allow data science to happen, and here you will find the best practices for doing each of these things with R. You’ll learn how to use … Read more →


Welcome to R packages by Hadley Wickham and Jenny Bryan. Packages are the fundamental units of reproducible R code. They include reusable R functions, the documentation that describes how to use them, and sample data. In this book you’ll learn how to turn your code into packages that others can easily download and use. Writing a package can seem overwhelming at first. So start with the basics and improve it over time. It doesn’t matter if your first version isn’t perfect as long as the next version is better. This is the work-in-progress 2nd edition of the … Read more →