`rmarkdown::run` cannot access an url that `download.file` can

I read somewhere that it was possible to run a learnr Rmarkdown document via an URL.

I wanted to test this functionality, and made a document that I can download:

> download.file('http://hub-courses.pages.pasteur.fr/R_pasteur_practice/test.Rmd', destfile = "/tmp/test.Rmd")
trying URL 'http://hub-courses.pages.pasteur.fr/R_pasteur_practice/test.Rmd'
Content type 'text/plain; charset=utf-8' length 4896 bytes
==================================================
downloaded 4896 bytes

However, when I pass the same URL to rmarkdown::run, I get a message saying that the directory does not exist:

> rmarkdown::run('http://hub-courses.pages.pasteur.fr/R_pasteur_practice/test.Rmd')
Error in rmarkdown::run("http://hub-courses.pages.pasteur.fr/R_pasteur_practice/test.Rmd") : 
  The directory 'http://hub-courses.pages.pasteur.fr/R_pasteur_practice' does not exist
In addition: Warning message:
In normalizePath(path, winslash = winslash, mustWork = mustWork) :
  path[1]="http://hub-courses.pages.pasteur.fr/R_pasteur_practice": No such file or directory

Here are some info about my rmarkdown settings:

> devtools::session_info('rmarkdown')
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       Ubuntu 16.04.6 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en:en_US:fr_FR              
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       :/etc/localtime             
 date     2020-03-02                  

─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────
 package   * version date       lib source        
 base64enc   0.1-3   2015-07-28 [1] CRAN (R 3.6.0)
 digest      0.6.25  2020-02-23 [1] CRAN (R 3.6.1)
 evaluate    0.14    2019-05-28 [1] CRAN (R 3.6.0)
 glue        1.3.1   2019-03-12 [1] CRAN (R 3.6.0)
 highr       0.8     2019-03-20 [1] CRAN (R 3.6.0)
 htmltools   0.4.0   2019-10-04 [1] CRAN (R 3.6.1)
 jsonlite    1.6.1   2020-02-02 [1] CRAN (R 3.6.1)
 knitr       1.28    2020-02-06 [1] CRAN (R 3.6.1)
 magrittr    1.5     2014-11-22 [1] CRAN (R 3.6.0)
 markdown    1.1     2019-08-07 [1] CRAN (R 3.6.1)
 mime        0.9     2020-02-04 [1] CRAN (R 3.6.1)
 Rcpp        1.0.3   2019-11-08 [1] CRAN (R 3.6.1)
 rlang       0.4.5   2020-03-01 [1] CRAN (R 3.6.1)
 rmarkdown * 2.1     2020-01-20 [1] CRAN (R 3.6.1)
 stringi     1.4.6   2020-02-17 [1] CRAN (R 3.6.1)
 stringr     1.4.0   2019-02-10 [1] CRAN (R 3.6.0)
 tinytex     0.20    2020-02-25 [1] CRAN (R 3.6.1)
 xfun        0.12    2020-01-13 [1] CRAN (R 3.6.1)
 yaml        2.2.1   2020-02-01 [1] CRAN (R 3.6.1)

[1] /home/bli/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library

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