getFunctionLengths: Compute the lengths of functions in a package's environment...

Description Usage Arguments Value Author(s) Examples

Description

This function computes a measure of the "complexity" or length of each of the functions

Usage

1
2
3
getFunctionLengths(pkg, 
                   isPackage = is.integer(pkg) || pkg %in% c(search(), gsub("package:", "", search())),
                   op = function(fun) length(body(fun)), ...)

Arguments

pkg

a character vector or environment object. If this is a character vector, it is treated either as the name of an R package in the search path, or the name of a source file containing function definitions.

isPackage

a logical value indicating whether the value of pkg identifies an R package on the search path or the name of an R source file.

op
...

Value

A named integer vector giving the length of each of the functions.

Author(s)

Duncan Temple Lang

Examples

1
2
3
4
5
6
7
  getFunctionLengths("package:RSourceTools")
  getFunctionLengths("RSourceTools")

  f = system.file("Rcode", "sampleCode.R", package = "RSourceTools")
  getFunctionLengths(f)

  getFunctionLengths("RSourceTools", op = functionLength)

omegahat/RSourceTools documentation built on May 24, 2019, 1:55 p.m.