Bookdown Pdf

  



What are the default page size and the default margins when creating a pdf with bookdown? For example, using the basic configuration provided in the index.Rmd file of the bookdown demo, we have:. R Markdown documents are converted to PDF by first converting to a TeX file and then calling the LaTeX engine to convert to PDF. By default, this TeX file is removed, however if you want to keep it (e.g., for an article submission), you can specify the keeptex option. 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. Download ligier x too r manual statistics:: pdb for Amazon free google manual on tlhudu.25u.com. In addition to the software we’ve written at RStudio, we’ve also authored these guides to our tools.

When you’re writing a report, you often refer to a table or figure in text.

Australia’s life expectancy has increased a great deal over the past 50 years (Figure 1)

Figure 1. Life expectancy from 1952 - 2007 for Australia. Life expectancy increases steadily except from 1962 to 1969. We can safely say that our life expectancy is higher than it has ever been!

And sure, this is figure 1.But what happens if actually, that figure should be moved later in the paper?You need to do the following:

  1. Update the reference to figure 1 in the text.
  2. Update the figure 1 caption to not say figure 1.

This is fine.

Once.

But it is never once. After this, it is frustrating, and error prone.

There is a way to solve this, which this lesson discusses.

12.1 Overview

  • Teaching 10 minutes
  • Exercises 15 minutes

12.2 Questions

Example
  • How do I refer to the table or figure in text and link to it?

12.4 How to refer to tables and figures in text?

In order to use this referencing style, you must use the following in the YAML

Or for HTML:

Or for word:

This is a new version of document that supports a better way to reference things in text.This reads as:

Make the output the HTML/PDF/Word document from the bookdown package.

That is, the special :: after bookdown, bookdown::html_document2 read as “The html_document2 function from the bookdown package”.

12.5 Your Turn

  1. Convert your output to use bookdown::html_document2 in your YAML.

12.6 Referencing a figure

To refer to a figure, you write the following in your text:

Figure @ref(fig:chunk-name))

12.6.1 Demo

Figure 12.1: Life expectancy from 1952 - 2007 for Australia. Life expectancy increases steadily except from 1962 to 1969. We can safely say that our life expectancy is higher than it has ever been!

Bookdown Pdf

Australia’s life expectancy has increased a great deal over the past 50 years (See Figure 12.1)

12.6.2 Your Turn

  1. Add a new plot in your document and reference it

Bookdown Pdf Margins

12.7 Referencing a table

To cite a table, you write the following:

Table @ref(tab:chunk-name))

We can see below in Table 12.1 the raw data used to create Figure 12.1).

Table 12.1: Raw gapminder data for Australia.
countrycontinentyearlifeExppopgdpPercap
AustraliaOceania195269.120869121210039.60
AustraliaOceania195770.330971256910949.65
AustraliaOceania196270.9301079496812217.23
AustraliaOceania196771.1001187226414526.12
AustraliaOceania197271.9301317700016788.63
AustraliaOceania197773.4901407410018334.20
AustraliaOceania198274.7401518420019477.01
AustraliaOceania198776.3201625724921888.89
AustraliaOceania199277.5601748197723424.77
AustraliaOceania199778.8301856524326997.94
AustraliaOceania200280.3701954679230687.75
AustraliaOceania200781.2352043417634435.37

12.7.1 Your Turn

  1. Create a table in your document and refer to it in text

12.8 Referencing a section

You can even reference a section in your report:

@ref(slug))

However, in order to write this, you need to include slug in your markdown header, like so:

For example, I can refer to the first section (Section 12) in this document by referring to the section as

Bookdown Pdf

@ref(start)

because it was written as:

One note here - your slug can not start with a number. Otherwise, it will print out the slug. So the following would not work:

You should instead write:

12.8.1 Your Turn

  1. Reference a section in the report.

Bookdown Pdf_document2

12.9 One small note

If you are using a template of some kind, such as those in rticles, and want the full featured citation features, then your YAML will need to include something like this:

Bookdown Pdf Example

This is the website for “Interactive web-based data visualization with R, plotly, and shiny”. In this book, you’ll gain insight and practical skills for creating interactive and dynamic web graphics for data analysis from R. It makes heavy use of plotly for rendering graphics, but you’ll also learn about other R packages that augment a data science workflow, such as the tidyverse and shiny. Along the way, you’ll gain insight into best practices for visualization of high-dimensional data, statistical graphics, and graphical perception. By mastering these concepts and tools, you’ll impress your colleagues with your ability to generate more informative, engaging, and repeatable interactive graphics using free software that you can share over email, export to pdf/png, and more.

An online version of this book, available at https://plotly-r.com, is free to use and is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 United States License. If you’d like a physical copy of the book, you can order it from CRC Press and Amazon. Both the print and online versions of the book are written in rmarkdown with bookdown and those source files are available at https://github.com/cpsievert/plotly_book. The online version will continue to evolve in between reprints of the physical book.