format_table_path: Format the path to output file

View source: R/utils.R

format_table_pathR Documentation

Format the path to output file

Description

Format the path to output file

Usage

format_table_path(file, dir = NULL, path.type = c("proj", "none", "raw"))

Arguments

file

the name of the output file.

dir

the directory where the output file is stored.

path.type

a character string indicating how the path to the output file should be formatted; use "proj" to have the path expressed relative to an RStudio project file; use "none" to format without any directory information (just the output file name); use "raw" to print the complete path to the file using dir as-is.

Details

Note that the default value for path.type is "proj". This requires that an RStudio project file is able to be found using rprojroot::find_root() with the rprojroot::is_rstudio_project criterion.

Once pmtables finds a root for a given working directory, it caches the value for the remainder of the R session. An error will be generated if a table is attempted to be saved using path.type="proj" but an RStudio project file was not able to be located.

Value

A string with the formatted table file path.

Examples

## Not run: 
format_table_path("foo.tex", "my/path")
format_table_path("foo.tex", "my/path", path.type = "proj")
format_table_path("foo.tx", "my/path", path.type = "raw")

## End(Not run)


metrumresearchgroup/pmtables documentation built on Dec. 22, 2024, 1:34 a.m.