vec_math {vctrs}R Documentation

Mathematical operations

Description

This generic provides a common dispatch mechanism for all regular unary mathematical functions. It is used as a common wrapper around the Summary group generics, the Math group generics, and a handful of other mathematical functions like mean().

Usage

vec_math(fun, x, ...)

vec_math_base(fun, x, ...)

Arguments

fun

An mathematical function as a string

x

A vector

...

An additional arguments.

Details

vec_base_arith() is provided as a convenience for writing methods. It calls the base fun on the underlying vec_data().

Included functions

See Also

vec_arith() for the equivalent for the arithmetic infix operators.

Examples

x <- new_vctr(c(1, 2.5, 10))
x

abs(x)
sum(x)
cumsum(x)

[Package vctrs version 0.1.0 Index]