Learn R Programming

dst (version 1.8.0)

reduction: 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)

Value

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

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)

Author

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

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

Run the code above in your browser using DataLab