I'm running the v1.2 preview of RStudio and playing around with the increased support for reticulate and Python.
This is how I typically organize my projects:
| project/
| -- data/
| ---- data.csv
| -- docs/
| ---- notebook.Rmd
|
| -- project.Rproj
In order to open data.csv in my notebook, I would use readr::read_csv(here::here("data", "data.csv")).
I'm trying to figure out the best way to manage Python's working directory in this structure if I want to call a python code chunk. My best effort so far is to include this as the initial code chunk in my notebook:
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
That yields the expected:
> import os
> print(os.getcwd())
/Users/chris/GitHub/project
instead of /Users/chris/GitHub/project/docs.
Are there any other suggestions out there for navigating this?