sig

0th

Percentile

Generate a function signature object

Generates a signature object for a function.

Usage
sig(fn, name_override)
Arguments
fn
A function.
name_override
Override the default function name. See examples.
Value

A list, with the elements
  • nameThe name of the function.
  • argsThe arguments of the function.

Note

Anonymous functions are given the name "..anonymous..".

Nonstandard names ("foo bar"), assignment fns ("foo<-"), operators (" in backquotes.

Aliases
  • sig
Examples
sig(R.Version)               #no args
sig(scan)                    #lots of args
sig(function(x, y) {x + y})  #anonymous
sig(sum)                     #primitive
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
)
Documentation reproduced from package sig, version 0.0-5, License: Unlimited

Community examples

Looks like there are no examples yet.