proj_workflow_use_rmd | R Documentation |
Use this function to create a new, templated RMarkdown file in a workflow
directory. It is mandatory to provide a name
. However, the path_proj
can be
omitted if you have an RMarkdown file from your project open and active
in the RStudio IDE; it will use the directory of that file.
proj_workflow_use_rmd( name, path_proj = NULL, open = rlang::is_interactive(), ignore = FALSE )
name |
|
path_proj |
|
open |
|
ignore |
|
This is an opinionated system; it introduces restrictions to help keep you "inside the boat":
All the RMarkdown files in a workflow are in the same directory; there are no sub-directories with RMarkdown files.
Using here::i_am()
establishes the root of the workflow as the
directory that contains the RMarkdown file. In other words, when the
RMarkdown file is rendered, this directory becomes the here::here()
root.
Also, using here::i_am()
, it provides a unique identifier for this file,
which will make a stronger guarantee that any rendering of this file happens
from inside this workflow directory.
It creates a dedicated data-directory for this file to write to, making sure
that this data-directory is empty at the start of the rendering. It also
provides an accessor function path_target()
that you can use later in the
file to compose paths to this data-directory. For example:
write.csv(mtcars, path_target("mtcars.csv"))
It also provides an accessor function to the data directory itself, which can be useful for reading data from "previous" files.
fun_data <- read.csv(path_data("00-import", "fun_data.csv"))
These opinionated features can help you access your data more easily, while helping to keep you "safely inside the boat".
Invisible NULL
, called for side effects.
# not run because it creates side effects ## Not run: # creates file `01-clean.Rmd` proj_workflow_use_rmd("01-clean") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.