I am writing an R package for a lab notebook. One function makes a new directoy with some Rmd files, opens the files with file.edit
, and changes the current working directory to the new directory. It would be great if I could also change the "Files" pane of RStudio to display that new folder from the function's code. Is this possible? I have looked through the rstudioapi
package. It does similar things (e.g. the viewer
function), but I cant find a way to change the path in the file navigator pane.
You should use the following code,
rstudioapi::filesPaneNavigate(getwd())
Hope that works!