knitr from command line = object 'params' not found

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"
  use_cache: TRUE
  produced_by: "produced by Aren Cambre"
    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") +

About the three backticks: you can simply wrap them in 4 backticks:

```{r blabla}

No idea for the question though

Thank you. I fixed the original post.

I reproduced on another machine, so I went ahead and filed a bug report at

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.