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"----
knitr::include_graphics("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, fig.height = 5, 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, 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()

Try the rjtools package in your browser

Any scripts or data that you put into this service are public.

rjtools documentation built on April 4, 2025, 4:40 a.m.