Learn R Programming

dst (version 1.8.0)

encode: Convert a value to its representation in another chosen base

Description

The aplEncode function of the project APL in R (https://rpubs.com/deleeuw/158476) has been adapted to follow the standard implementation of the APL encode function.

Usage

encode(base, ind)

Value

A vector or a matrix of the data converted.

Arguments

base

A numeric vector which describes the number system in which we want to recode the data.

ind

The value to convert represented by a number or a numeric vector.

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

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

  • APL 68000 Level II language manual. MicroAPL Ltd. 1990.

Examples

Run this code
encode(c(2,2,2,2), 11)  # find the base 2 representation of number 11
encode(c(365,24,60), 2997) # convert 2997 minutes to days-hrs-min.

Run the code above in your browser using DataLab