Learn R Programming

optimStrat (version 2.0)

absdif: Absolute Difference

Description

Compute the absolute differences between x and y.

Usage

absdif(x, y)

Arguments

x

a numeric vector, matrix or data frame.

y

a numeric vector, matrix or data.frame.

Value

An object with the absolute differences between x and y.

Details

Compute the absolute differences between x and y componentwise.

If x and y are vectors of different length, the elements of the shortest one will be recycled as necessary. If matrices or data frames, they should be of the same dimension.

Examples

Run this code
# NOT RUN {
absdif(1:10, 10:1)

x<- matrix(1:12, 4, 3)
y<- matrix(12:1, 4, 3)
absdif(x, y)
# }

Run the code above in your browser using DataLab