SciencesPo (version 1.3.9)

psum: The Missing R Parallel Sum

Description

Provides parallel sum like pmin and pmax from the base package. The function sum simply does not help when the objective is to obtain a vector with parallel sum rather than a scalar value.

Usage

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

Arguments

na.rm
A logical value TRUE or FALSE, the default
...
One or more unit objects

Value

  • A vector containing the parallel sum.

encoding

UTF-8

Examples

Run this code
if (interactive()) {
n <- 20;
mydat <- data.frame(PT = rnorm(n, mean = .30),
PSDB = rnorm(n, mean = .25), PSB = rnorm(n, mean = .15));
head(mydat);
transform(mydat, DK = psum(PT, PSDB, PSB - 1));
}

Run the code above in your browser using DataLab