open_rmd
opens an R Markdown file in RStudio and sets the working
directory to analysis/
. If the file does not exist, it creates a new
Rmd using the workflowr template.
open_rmd(filename, change_wd = TRUE, open_file = TRUE, path = ".")
The basename of the R Markdown file.
Should the working directory be changed to the analysis subdirectory? (default: TRUE)
Should the file be opened in RStudio editor? (default: TRUE)
By default the function assumes the current working directory is within the project. If this is not true, you'll need to provide the path to the project directory.
Invisibly returns the full path to the R Markdown file.
open_rmd
is a convenience function to make it easier to start working,
especially when starting a new analysis. It will create the new file if
necessary, set the working directory to analysis/
, and open the file
in RStudio. The latter two side effects can be turned off if desired.
If you are not using RStudio and are comfortable with relative paths and
managing your working directory, you could instead use directly use the
underlying commands. First set the working directory to the analysis/
subdirectory of your workflowr project. Second create the new file with
draft("model-data.Rmd", template = "analysis", package = "workflowr",
edit = FALSE)
. Third open the file in your text editor.
# NOT RUN {
open_rmd("model-data.Rmd")
# }
Run the code above in your browser using DataLab