Template example

Author

rspacer authors

Published

June 29, 2024

Title

Template example

Date

29-06-2024

Main part

You can write any code, as long as you have the same amount of h2 headers (with 2 ##) as in your structured document template. For example if you want to plot the Sepal.Length and Sepal.Width of the iris data frame:

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
dim(iris)
[1] 150   5
head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa

A header with level h3

And a plot:

iris %>%
  ggplot(aes(x = Sepal.Length, y = Sepal.Width)) +
  theme_classic() +
  geom_point()

Conclusion

In this minimal example template, we generated a html file from quarto that can be used to create a document in RSpace using the document_create_from_html() function.