Get the path to the currently active file in the RStudio editor.
Arguments
- ...
Arguments passed on to
rstudioapi::getSourceEditorContextidThe ID of a particular document, as retrieved by
documentId()or similar. Supported in RStudio 2022.06.0 or newer.
Examples
if(interactive()) current_file()