An object (typically a function) containing source references.
full.names
Whether to include the full path in the filename result.
unique
Whether to list only unique filenames/directories.
which
Which part of a source reference to extract. Can be abbreviated.
first
Whether to show the first (or last) location of the object.
Value
getSrcFilename and getSrcDirectory return character vectors
holding the filename/directory. getSrcref returns a list of "srcref" objects or
NULL if there are none. getSrcLocation returns an integer vector of the requested type
of locations.
Details
Each statement of a function will have its own source reference if the
"keep.source" option is TRUE. These functions retrieve
all of them. The components are as follows:
line
The line number where the object starts or ends.
column
The column number where the object starts or ends.
byte
As for "column", but counting bytes, which may
differ in case of multibyte characters.
fn <- function(x) {
x + 1# A comment, kept as part of the source}
# Show the temporary file directory# where the example was saved
getSrcDirectory(fn)
getSrcLocation(fn, "line")