R/getFunctionSignature.R

Defines functions getFunctionSignature

getFunctionSignature <- function(functionName_s_1) {
  f <- tryCatch(get(functionName_s_1, mode = 'function'), error = function(e) NULL)
  if (is.null(f)) abort('no function', functionName_s_1, 'found')

  fo <- retrieveFunctionArguments(f)
  ag <- sapply(seq_len(length(fo)), function(k) {
    p <- manageSingleStrings(fo[[k]])
    paste0(names(fo[k]), if (length(p) == 0) '' else if (nchar(p) > 0) paste(' =', p) else '')
  }, simplify = FALSE)

  paste0(functionName_s_1, strParenthesis(strJoin(normalizeSpaces(ag), ', ')))
}

Try the wyz.code.rdoc package in your browser

Any scripts or data that you put into this service are public.

wyz.code.rdoc documentation built on Oct. 6, 2021, 9:07 a.m.