I have a blogdown file that works fine if I just execute the R code, but when I try to run it through blogdown::serve_site(), it fails.
Here is my reproducible code:
title: Reprex
author: Alan Jackson
date: '2019-05-26'
slug: reprex
categories:
- Pollen
tags: - Houston
keywords: - tech
library(tidyverse)
path <- "https://www.houstontx.gov/health/Pollen-Mold/Pollen_Archives/"
url_list <- tribble(
~url,
"january_2013_pollen.xls",
"febraury_2013_pollen.xls",
"march_2013_pollen.xls",
"april_2013_pollen.xls",
"may_2013_pollen.xls"
)
for (url in url_list[,1]){
download.file(paste0(path, url), destfile=url, mode="wb")
}
When I run the code (in rstudio), it works just fine, reading in the files and saving them. However, when I run blogdown,
blogdown::serve_site(content/post/2019-05-26-reprex.Rmd)
...stuff...
Rendering content/post/2019-05-26-reprex.Rmd
Quitting from lines 15-33 (2019-05-26-reprex.Rmd)
Error in download.file(paste0(path, url), destfile = url, mode = "wb") :
'url' must be a length-one character vector
Calls: local ... withCallingHandlers -> withVisible -> eval -> eval -> download.file
Execution halted
Error in render_page(f) :
Failed to render 'content/post/2019-05-26-reprex.Rmd'
Looking further I see that it is a knitr failure - I still don't understand it though.
Even stranger. This works from the console in RStudio:
rmarkdown::render('content/post/2019-05-26-reprex.Rmd')
But executing knitr from the button or "serve site" from the Blogdown addins menu fails. So there is apparently some odd interaction within RStudio causing issues for knitr.