sig | R Documentation |
Generates a signature object for a function.
sig(fn, name_override, ...) ## Default S3 method: sig(fn, ...) ## S3 method for class 'character' sig(fn, ...) ## S3 method for class 'call' sig(fn, ...) ## S3 method for class 'formula' sig(fn, ...) ## S3 method for class 'name' sig(fn, ...)
fn |
A function. |
name_override |
Override the default function name. See examples. |
... |
For possible additional future arguments, currently unused. |
A list, with the elements
nameThe name of the function.
argsThe arguments of the function.
Anonymous functions are given the name "..anonymous..".
Nonstandard names ("foo bar"), assignment fns ("foo<-"), operators (" in backquotes.
sig(R.Version) #no args sig(scan) #lots of args sig(function(x, y) {x + y}) #anonymous sig(sum) #primitive sig("sd") #string input sig("function(x, y) {x + y}") sig(~ prod) #formula input sig(~ function(x, y) {x + y}) sig(quote(paste0)) #name input sig(quote(function(x, y) {x + y})) fn_list <- list( mean = mean, var = var ) lapply(fn_list, sig) #names are a mess Map( #use Map for lists sig, fn_list, names(fn_list) #Map mangles names, so override )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.