Write sigs to file
Writes a list of function signatures to a file.
1 2 3 4 5 6 7 8 9 10 11 12 13
write_sigs(x, file = stdout(), ...) ## Default S3 method: write_sigs(x, file = stdout(), ...) ## S3 method for class 'siglist' write_sigs(x, file = stdout(), ...) ## S3 method for class 'environment' write_sigs(x, file = stdout(), ...) ## S3 method for class 'character' write_sigs(x, file = stdout(), ...)
A list of function signatures. See details.
A file path or connection to write the output to (stdout by default).
x is an object of class |codesiglist, the
function essentially calls
If the input is a single function signature (of class
then it is coerced into a
siglist. If the input is an
environment or path to a file, then
list_sigs is called on
the input before writing.
A character vector of the lines that were written to file is invisibly returned. Mostly invoked for the side effect of writing function signatures to a file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#Step by step: #First, list some sigs. utils_sigs <- list_sigs(pkg2env(utils)) #Without a file argument, sigs are just printed to the console. head(write_sigs(utils_sigs)) #Write to a file tmpf <- tempfile("sig", fileext = ".R") write_sigs(utils_sigs, tmpf) ## Not run: Open the file we've just written shell(tmpf, wait = FALSE) ## End(Not run) #Can also list and write in one line. tmpf2 <- tempfile("sig", fileext = ".R") write_sigs(pkg2env(grDevices), tmpf2) #Single sigs are coerced to siglists write_sigs(sig(stats::var))
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.