inst/paper-with-errors/paper-with-errors.R

# Generated by `rjournal_pdf_article()` using `knitr::purl()`: do not edit by hand
# Please edit paper-with-errors.Rmd to modify this file

## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
library(plotly)
library(ggplot2)
library(palmerpenguins)


## ----penguins-alison, out.width = "100%", out.height = "30%", fig.cap = "Artwork by \\@allison\\_horst", fig.alt="A picture of three different penguins with their species: Chinstrap, Gentoo, and Adelie. "----
knitr::include_graphics("figures/penguins.png")


## ----penguins-tab-interactive, eval = knitr::is_html_output(), layout = "l-body-outset"----
# knitr::kable(head(penguins), format = "html", caption = "A basic table")


## ----penguins-tab-static, eval = knitr::is_latex_output()---------------------
knitr::kable(head(penguins), format = "latex", caption = "A basic table") %>% 
  kableExtra::kable_styling(font_size = 7)


## ----penguins-plotly, echo = TRUE, out.width="100%", fig.width = 6, fig.height=5, layout="l-body", fig.cap="A basic interactive plot made with the plotly package on palmer penguin data. Three species of penguins are plotted with bill depth on the x-axis and bill length on the y-axis. When hovering on a point, a tooltip will show the exact value of the bill depth and length for that point, along with the species name.", include=knitr::is_html_output(), eval=knitr::is_html_output()----
# p <- penguins %>%
#   ggplot(aes(x = bill_depth_mm, y = bill_length_mm,
#              color = species)) +
#   geom_point()
# ggplotly(p)


## ----penguins-ggplot, echo = TRUE, out.width="100%", fig.width = 6, fig.height=5, fig.cap="A basic non-interactive plot made with the ggplot2 package on palmer penguin data. Three species of penguins are plotted with bill depth on the x-axis and bill length on the y-axis. Visit the online article to access the interactive version made with the plotly package.", include=knitr::is_latex_output(), eval=knitr::is_latex_output()----
penguins %>% 
  ggplot(aes(x = bill_depth_mm, y = bill_length_mm, 
             color = species)) + 
  geom_point()
rjournal/rjtools documentation built on June 1, 2025, 2:51 p.m.