Learn R Programming

gofMC (version 1.1.2)

difn: Find differences

Description

Finds the difference between two vector components, n places apart. Like diff(), but faster and pads missing values with 0.

Usage

difn(x, n = 1)

Arguments

x
a numeric vecor
n
an integer, pos or neg

Value

numeric vector

Examples

Run this code
difn(c(1,2,4,7,12),n=2)

Run the code above in your browser using DataLab