One Template for Quarto Report

tutorial
quarto
A template used for academic reporting
Author

Jihong Zhang

Published

June 27, 2023

R Code
library(ggplot2)
Warning: package 'ggplot2' was built under R version 4.2.3
R Code
library(hexSticker)

p <- ggplot(aes(x = Sepal.Length, y = Sepal.Width), data = iris) + 
  geom_point(shape = 6, color = "white")
p <- p + theme_void() + theme_transparent()

sticker(p, package="quarto", p_size=20, s_x=1, s_y=.75, 
        s_width=0.7, s_height = 0.7,
        h_fill = "#B4464B", filename="ggplot2.png")

knitr::include_graphics("ggplot2.png")

#| echo: fenced
title: "NEET Analysis"
author: "Jihong Zhang"
format: 
  html:
    header-includes: |
      <link href="https://fonts.googleapis.com/css2?family=Ysabeau+Infant&display=swap" rel="stylesheet">
    mainfont: 'Ysabeau Infant'
    self-contained: true
    toc: true
    code-fold: true
    code-summary: ' R Code'
    code-line-numbers: true
    number-sections: true
    number-offset: 1
R Code
```{r}
#| label: setup
#| eval: false
#| message: false
#| warning: false
root_dir = "/Users/clap/OneDrive - The Chinese University of Hong Kong/01_CLAP@JC/LatentClassModel"
knitr::opts_chunk$set(echo = TRUE, message=FALSE, warnings=FALSE, include = FALSE)
knitr::opts_knit$set(root.dir = root_dir)
library(here)
library(glue)
library(bruceR)
library(xtable)
library(formattable) # format styles of table 
library(reshape2)
library(tidyverse)
library(ggtext) 
library(kableExtra)
library(MplusAutomation)
library(fastDummies)
options(knitr.kable.NA = '')
mycolors = c("#4682B4", "#B4464B", "#B4AF46", 
             "#1B9E77", "#D95F02", "#7570B3",
             "#E7298A", "#66A61E", "#B4F60A")
softcolors = c("#B4464B", "#F3DCD4", "#ECC9C7", 
               "#D9E3DA", "#D1CFC0", "#C2C2B4")
mykbl <- function(x, ...){
  kbl(x, digits = 2, ...) |> kable_styling(bootstrap_options = c("striped", "condensed")) 
}
```

Output example

Back to top