I have a publish.R script that uses knit2wp
to publish an Rmd to WordPress. The Rmd has a lot of plots.
When I run publish.R from RStudio, everything works as expected, and I get a page with a lot of plots.
When I run publish.R from the command line, whenever I reference the params
object, I get an error in place of the plots in the final rendered notebook. I am using a parameter to define each plot's subtitle
field. This is an example error, which again shows in the final rendered output, instead of stopping execution: ## Error in list2(..., title = title, subtitle = subtitle, caption = caption, : object 'params' not found.
Additionally, the output on the command line includes several of these warnings: message: logi FALSE
.
I am running R 4.0.3 on Windows 10. I am logged in as the same user regardless of whether I use RStudio or the command prompt.
This is my YAML header:
---
title: "COVID-19 stats for Dallas and Texas"
params:
use_cache: TRUE
produced_by: "produced by Aren Cambre"
output:
html_document:
df_print: paged
toc: true
---
This is an example plot that uses the params object:
```{r Dallas/Fort Worth TSA region COVID-19-related hospitalizations by day}
comprehensive_hospitalization_data_long %>%
filter(`TSA AREA` == "Dallas/Ft. Worth",
type == "all COVID-19 hospitalizations") %>%
ggplot(aes(x = date, y = value)) +
geom_area() +
labs(title = "Dallas/Fort Worth TSA region COVID-19-related hospitalizations, by day",
subtitle = params$produced_by,
caption = "data from Texas DSHS") +
xlab("date") +
ylab("daily hospitalization count") +
theme_light()
```