label_src: Generate source file label
Description
Generate a label with the current source file path and run time,
assuming that the source file is in the current working directory.
In interactive sessions, the function is designed to work in a script file in RStudio
and uses rstudioapi to get the file path.
It will return empty if run in the console directly.
Usage
label_src(span = 2, omit = "", tz = TRUE, fname = FALSE)
Value
A label showing the source file path with a time stamp.
Arguments
- span
<int> Number of lines: either 1 or 2.
- omit
<chr> Text to omit from the label.
- tz
<lgl> FALSE to exclude time stamp.
- fname
<lgl> TRUE to return the file name only.
Examples
Run this codelabel_src()
label_src(tz=FALSE)
label_src(fname=TRUE)
Run the code above in your browser using DataLab