pfun: Pairwise binary functions

View source: R/utils.R

pfunR Documentation

Pairwise binary functions

Description

Perform binary operations on vectors, matrices, or data frames.

Usage

pfun(..., na.rm = FALSE, FUN = `+`)

psum(..., na.rm = FALSE)

Arguments

...

numeric vectors, matrices, or data frames with equal dimensions

na.rm

logical; if TRUE, omits missing values (including NaN) from calculations

FUN

a binary function

Value

An object similar to input objects after successively combining elements with FUN.

See Also

pmin; pmax

Examples

x <- c(-1, NA, 4, 15)
y <- c(NA, NA, 6, -1)

x + y
psum(x, y)
psum(x, y, na.rm = TRUE)

x <- matrix(x, 4, 4)
y <- matrix(y, 4, 4)
x + y
psum(x, y)
psum(x, y, na.rm = TRUE)

x - y - x
pfun(x, y, x, FUN = `-`)
pfun(x, y, x, FUN = `-`, na.rm = TRUE)


raredd/rawr documentation built on March 4, 2024, 1:36 a.m.