Learn R Programming

workflowr (version 0.7.0)

wflow_view: View research website locally.

Description

wflow_view displays the website locally in your browser.

Usage

wflow_view(files = NULL, recent = FALSE, dry_run = FALSE, project = ".")

Arguments

files

character (default: NULL). Name(s) of the specific file(s) to open in the browser. These can be either the name(s) of the R Markdown file(s) in the analysis directory or the HTML file(s) in the docs directory. Also, the full path(s) to the file(s) can be input or just the basename(s) of the file(s).

recent

logical (default: FALSE). If files = NULL, display the HTML file with the most recent modification time. If files = NULL and recent = FALSE, then index.html is opened.

dry_run

logical (default: FALSE). Do not actually open file(s) in browser. Mainly useful for testing.

project

character (default: ".") 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.

Value

Invisibly returns a character vector of the relative paths to the HTML files to be opened.

Details

wflow_view by default opens the file index.html. To view the most recently modified HTML file, set recent = TRUE. To specify which file(s) to open, specify either the name(s) of the R Markdown or HTML file(s). The path(s) to the file(s) will be discarded, thus only HTML files in docs directory can be viewed with this function.

wflow_view uses browseURL to open the HTML files in the browser. If you wish to do something non-traditional like open an HTML file that is not in the docs directory or not part of a workflowr project, you can use that function directly.

See Also

browseURL

Examples

Run this code
# NOT RUN {
# View index.html
wflow_view()

# View the most recently modified HTML file
wflow_view(recent = TRUE)

# View a file by specifying the R Markdown file
# (the following two are equivalent)
wflow_view("fname.Rmd")
wflow_view("analysis/fname.Rmd")

# View a file by specifying the HTML file
# (the following two are equivalent)
wflow_view("fname.html")
wflow_view("docs/fname.html")

# View multiple files
wflow_view(c("fname1.Rmd", "fname2.Rmd"))
# }

Run the code above in your browser using DataLab