rowdiff: Get row differences between values

Description Usage Arguments Value See Also Examples

Description

This function returns the differences between rows depending on the user's choice.

Usage

1
2
3
4
5
6
7
8
rowdiff(
  df,
  direction = "forward",
  exclude = NULL,
  na.rm = FALSE,
  na_action = NULL,
  ...
)

Arguments

df

The data set for which differences are required

direction

One of forward and reverse. The default is forward meaning the differences are calculated in such a way that the difference between the current value and the next is returned

exclude

A character vector specifying what classes should be removed. See examples below

na.rm

Logical. Should missing values be removed? The missing values referred to are those introduced during the calculation ie when subtracting a row with itself. Defaults to FALSE.

na_action

If na.rm is TRUE, how should missing values be replaced? Depending on the value as set out in ‘na_replace', the value can be replaced as per the user’s requirement.

...

Other arguments to 'na_replace'.

Value

A data.frame object of row differences

See Also

na_replace

Examples

1
2
3
4
5
# Remove factor columns
data("yields", package="manymodelr")
rowdiff(yields,exclude = "factor",direction = "reverse")
rowdiff(yields[1:5,], exclude="factor", na.rm = TRUE, 
na_action = "get_mode",direction = "reverse")

manymodelr documentation built on Nov. 15, 2021, 5:07 p.m.