reduction: Summary of a vector for any operator.

View source: R/reduction.R

reductionR Documentation

Summary of a vector for any operator.

Description

This utility function is used to obtain a summary of a vector of data for many operators. The function is taken from the project APL in R (https://rpubs.com/deleeuw/158476).

Usage

reduction(x, f)

Arguments

x

A vector of numbers or a character string.

f

The operator. Must be compatible with the type of input vector (numeric or character)

Value

The result of applying the chosen operator to all the elements of the vector is an object of length 1.

Author(s)

Claude Boivin

References

  • Jan de Leeuw and Masanao Yajima (March 07, 2016) APL in R (Version 009), Source code. https://rpubs.com/deleeuw/158476

  • G. Helzer. (1989): An Encyclopedia of APL, second edition, I-APL LTD, St. Albans, G.B.

  • L. Gilman and A. J. Rose.(1974): APL an Interactive Approach, Second Edition, John Wiley, New-York.

Examples

 reduction(c(1,2,3,4), f = "-")
 reduction(c(1,0,1,1,0), f = "|")
 reduction(c("a", "b", "c"), f = "paste")
 

dst documentation built on Nov. 16, 2023, 5:08 p.m.