I try to save a variable to a relative path. The R code runs without a problem in RStudio, but as soon as I compile the RMarkdown file i get a reproducible error (only if the destination path is relative).
This is my RMarkdown file:
---
title: "Untitled"
output: html_document
---
```{r test}
x<-"test"
save(x,file="./raw_data/test.r")
```
This is the resulting error:
processing file: Untitled.Rmd
Quitting from lines 7-9 (Untitled.Rmd)
Error in gzfile(file, "wb") : cannot open the connection
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> save -> gzfile
Execution halted
Is this a bug / does knitr not support relative directory paths?
Thanks