RstudioServer 1.2.1153 on Ubuntu 18.04.1 LTS: Rmarkdown deals wrongly with tempfiles

Hello All,

I recently switched to Rstudio server on Ubuntu. I noticed that when I am running R markdown document (that contains flexdashboard and shiny elements) and which runs without a hinge well on windows gives the following warning when I press Run document on the IDE:

Warning in file.rename(from, to) :
cannot rename file '/tmp/Rtmpk1PyVy/file4ac06d25657b_files/figure-html' to '/tmp/Rtmpk1PyVy//tmp/Rtmpk1PyVy/file4ac06d25657b_files/figure-html', reason 'No such file or directory'
/usr/lib/rstudio-server/bin/pandoc/pandoc +RTS -K512m -RTS /tmp/Rtmpk1PyVy/INGholdings.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output /tmp/Rtmpk1PyVy/file4ac06d25657b.html --email-obfuscation none --standalone --section-divs --template /home/ggbo/R/x86_64-pc-linux-gnu-library/3.5/flexdashboard/rmarkdown/templates/flex_dashboard/resources/default.html --id-prefix section- --variable 'theme:cosmo' --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/Rtmpk1PyVy/file4ac079b31ab8html --include-before-body /tmp/Rtmpk1PyVy/file4ac04d215328.html --highlight-style pygments --include-before-body /tmp/Rtmpk1PyVy/file4ac06238bada.html --include-after-body /tmp/Rtmpk1PyVy/file4ac0726c1dfb.html
Warning in file.rename(from, to) :
cannot rename file '/tmp/Rtmpk1PyVy//tmp/Rtmpk1PyVy/file4ac06d25657b_files/figure-html' to '/tmp/Rtmpk1PyVy/file4ac06d25657b_files/figure-html', reason 'No such file or directory'

Output created: /tmp/Rtmpk1PyVy/file4ac06d25657b.html

I check if this file exists and it does exists however I thing that the link it looks for the file is wrong

'/tmp/Rtmpk1PyVy//tmp/Rtmpk1PyVy/file4ac06d25657b_files/figure-html',

should be

'/tmp/Rtmpk1PyVy/file4ac06d25657b_files/figure-html',

Can someone please advise me what to do?

kind regards,

Laurens van der Burg

Can you provide a reproducible example? How are you invoking rmarkdown::render()?

1 Like

Please find below a minimal example

I envoked it using both

rmarkdown::run(file = "~/minexample.rmd", shiny_args = list(port = XXXX, host ="192.168.xxx.yyy"))

XXXX replaced with 4 digit portnumer and ip-port with valid ip number of rstudio server
and

the run document button on the IDE.

Both return the same error.
The figure is still plotted on the preview window that pops out rstudio. But if I use the browser to navigate to the ip-adress and port number only the frame border is printed and the sizing is completely lost.

If I execute all statements manually in the terminal they operate without error. (but offcourse no html file as a result)

start example

---
title: "Problem"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
runtime: shiny

---


<!-- rmarkdown::run(file = "~/minexample.rmd", shiny_args = list(port = xxx, host ="192.168.xxx.yyy")) -->

```{r setup, include=FALSE}
# options(keyring_backend = 'env')

library(flexdashboard)
# library(lubridate)
library(ggplot2)
# library(ggthemes)
# library(plotly)
# library(knitr)
library(data.table)
library(DT)
# library(shiny)
# library(fontawesome) #github onofficial
# library(moments)
# library(QRM)
# library(PerformanceAnalytics)
# library(keyring)


 
```
RISK
====================================================
  
Column {data-width=500,}
-----------------------------------------------------------------------
  
### VaR
  
```{r RISK: VAR}

load(file = "~/PFreturns.rda")

 ReturnsPlot <- PFreturns %>%
   ggplot(aes(x = returns)) +
   # ylab("frequency %") +
   # xlab("return") +
   # theme_bw() +
   geom_line(aes(y = yvals), size = 1)  #+
   # geom_freqpoly() #+
   # 
 
ReturnsPlot

# ggplotly(ReturnsPlot)


```

end example

error message:

usr/lib/rstudio-server/bin/pandoc/pandoc +RTS -K512m -RTS /tmp/RtmpDxXWry/minexample.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output /tmp/RtmpDxXWry/file24b22cfdc14d.html --email-obfuscation none --standalone --section-divs --template /home/ggbo/R/x86_64-pc-linux-gnu-library/3.5/flexdashboard/rmarkdown/templates/flex_dashboard/resources/default.html --id-prefix section- --variable 'theme:cosmo' --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpDxXWry/file24b26bf9315dhtml --include-before-body /tmp/RtmpDxXWry/file24b21b24b4c5.html --highlight-style pygments --include-before-body /tmp/RtmpDxXWry/file24b27f0fce09.html --include-after-body /tmp/RtmpDxXWry/file24b21b1aa9e7.html
output file: /tmp/RtmpDxXWry/minexample.knit.md

Warning in file.rename(from, to) :
cannot rename file '/tmp/RtmpDxXWry/file24b22cfdc14d_files/figure-html' to '/tmp/RtmpDxXWry//tmp/RtmpDxXWry/file24b22cfdc14d_files/figure-html', reason 'No such file or directory'
Warning in file.rename(from, to) :
cannot rename file '/tmp/RtmpDxXWry//tmp/RtmpDxXWry/file24b22cfdc14d_files/figure-html' to '/tmp/RtmpDxXWry/file24b22cfdc14d_files/figure-html', reason 'No such file or directory'

Output created: /tmp/RtmpDxXWry/file24b22cfdc14d.html

RDA file

can be downloaded from here:

Here's a simpler MRE:

---
title: "Warning in file.rename(from, to)"
runtime: shiny
---

```{r}
plot(1)
```

The associated issue has already been filed on the rmarkdown repository: https://github.com/rstudio/rmarkdown/issues/1224

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