Replaces the content of an existing file in Google Drive with the contents of
a local file. It is also possible to update (or upload if not already
present) the output (pdf or html) of the file specifying the
path_output
argument. In case of html files, if pagedown
package and Chrome are available, users can decide to upload a pdf version of
the html file.
Use with caution as tracked changes in the Google Drive file will be
lost!
To know more about trackdown
workflow and features see
trackdown-package()
help page.
Usage
update_file(
file,
gfile = NULL,
gpath = "trackdown",
shared_drive = NULL,
hide_code = FALSE,
path_output = NULL,
rich_text = TRUE,
rich_text_par = NULL,
force = FALSE,
open = rlang::is_interactive()
)
Arguments
- file
character. The path of a local
.Rmd
, Quarto, or.Rnw
file.- gfile
character. The name of a Google Drive file (defaults to local file name).
- gpath
character. (Sub)directory in My Drive or a shared drive (optional). By default files are uploaded in the folder "trackdown". To specify another folder the full path is required (e.g., "trackdown/my_folder"). Use
NULL
to upload directly at the root level, although it is not recommended.- shared_drive
character. The name of a Google Drive shared drive (optional).
- hide_code
logical value indicating whether to remove code from the text document (chunks and header). Placeholders of type
"[[chunk-<name>]]"
are displayed instead.- path_output
default
NULL
, specify the path to the output to upload together with the other file. PDF are directly uploaded, HTML can be first converted into PDF if packagepagedown
and Chrome are available.- rich_text
logical value (default is
TRUE
) indicating whether to upload to Google Docs a rich document (i.e., important text that should not be changed is highlighted). See “Rich Text” in details section.- rich_text_par
argument used to pass a list with custom settings for rich_text. See “Rich Text” in details section.
- force
logical value indicating whether to skip confirm check by user (default is
FALSE
).- open
logical value indicating whether to open the created document in a browser (default is
TRUE
in interactive sessions).
Details
The rich_text
option (default is TRUE
) allows to upload a rich
document to Google Docs. Important text that should not be changed is
highlighted. This includes, added instructions at the top of the document,
placeholders hiding the code, header of the document (YAML header or LaTeX
preamble), code chunks, and in-line code.
Default colour is opaque yellow. You can customize the colour specifying the
rgb_color
option in the rich_text_par
argument. The
rgb_color
has to be a list with elements red
, green
, and blue
.
Each element has to be a numeric value between 0 and 1. See example below.