Hello. If I run the following code chunks in the R console, everything turns out as expected. However, if I try to render the file, I get no errors but the simple plot does not display.
---
title: "Untitled"
format: html
---
```{r, message=FALSE, warning=FALSE}
#| label: load-packages
#| include: false
options(scipen = 100, digits = 4)
library(rmarkdown)
library(quarto)
library(readxl)
library(Hmisc)
library(tidyverse)
library(DT)
library(gtsummary)
library(datasets) # Added for this example
```
# Section 1
Some dummy text for testing purposes.
```{r}
#| label: viewdata
#| #|: include: false
summary(iris)
tabs <- function() {
tbl_summary_1 <- df1 %>%
tbl_summary(
by = Species,
statistic =
list(all_continuous() ~ "{min} {mean} {median} {sd} {max}",
all_categorical() ~ "{n} ({p})")
)
return(tbl_summary_1)
tbl_summary_1
}
df1 <- iris # Not needed but inserted for comparability to the function used in source program.
tabs()
plot1 <- ggplot(iris, aes(x = Species, y = Sepal.Length)) +
geom_boxplot() +
labs(title = "Box Plot of Sepal Length by Species",
x = "Species",
y = "Sepal Length") +
theme_minimal()
plot1
```
# Section 2
I should have table and plot presented in the Quarto document.
Thank you in advance.