code works except in blogdown

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

  • Pollen
  • Houston
  • tech


path <- ""

url_list <- tribble(

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,



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:


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.

Found the solution.


for (url in url_list[,1])


for (url in unlist(url_list[,1]))

and the file now knits.

1 Like

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