calcColumnDiffs: Calculate differences between dataframe columns by row

View source: R/calcColumnDiffs.R

calcColumnDiffsR Documentation

Calculate differences between dataframe columns by row

Description

Function to calculate differences between dataframe columns by row.

Usage

calcColumnDiffs(dfr, col, cols = NULL, adjacent = FALSE)

Arguments

dfr
  • dataframe

col
  • column name for base

cols
  • vector of column names to compute by-row differences for (or NULL)

adjacent
  • flag to compute differences between "adjacent" columns (default=FALSE)

Details

If cols is NULL, then differences will be commputed as if cols was the vector of names of columns to the "right" of col. If adjacent=FALSE, then all differences are relative to col as the base. Otherwise, after the first difference, the base column is sequentially moves through those in cols.

Value

copy of input dataframe with extra columns representing column differences


wStockhausen/wtsUtilities documentation built on March 16, 2024, 10:38 a.m.