Functions to Work with Lists

Description

Combine lists or perform arithmetic operations on elements of lists.

Usage

1
2
3
4
  lsub(x, y)
  lsum(x, y)
  pprod(x, y)
  which.pmax(elts, na.rm = FALSE, pmin = FALSE)

Arguments

x

list

y

list (lsub, lsum), or numeric (pprod)

elts

list, numeric vectors for which to find maximum values (in parallel) (which.pmax).

na.rm

logical, remove missing values?

pmin

logical, find minimum values instead of maximum ones?

Details

lsub subtracts the elements of list y from the respective ones in list x. lsum sums the respective elements of lists x and y. pprod multiplies each element of list x by the respective numeric value in y.

which.pmax takes a list of equal-length numeric vectors (or objects that can be coerced to numeric) in elts and returns the index of the vector holding the maximum value at each position. If na.rm is TRUE, values of NA are removed; if pmin is TRUE the function finds locations of the minimum values instead.

Value

lsub, lsum and pprod return lists.

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.