This function formats a file path highlighted in the source pane to work with here::here() or file.path() by separating the string into its component parts and quoting and comma-separating these elements. For best use, we recommend using this functionality via the associated AddIn, or by binding the AddIn to a keyboard shortcut, rather than calling the function interactively from the console.

format_path(fns = c("here", "file.path"))

Arguments

fns

Defines the functions to target for cleaning. Default is to clean the file paths of both here() and file.path(), but one or the other can be specified if running the command interactively (i.e. not via the AddIn).

Value

Updated path as recommended by here::here(), split into individual quoted and comma-separated segments.