Learn R Programming

recexcavAAR (version 0.2.2)

spatialwide: Transformation of numeric matrices from long to wide format

Description

Transforms a set of two independent and one dependent variables in vectors from a long to a wide format and exports this result as a list

Usage

spatialwide(x, y, z, digits)

Arguments

x
vector of first independent variable. e.g. vector with x-axis spatial points
y
vector of second independent variable. e.g. vector with y-axis spatial points
z
vector of dependent variable. e.g. vector with z-axis spatial points
digits
integer indicating the number of decimal places to be used for rounding the dependent variables x and y.

Value

List with three elements:$x: vector with ascendingly sorted, unique values of the first independent variable x$y: vector with ascendingly sorted, unique values of the second independent variable y$z: matrix with the values of z for the defined combinations of x (columns) and y (rows)

See Also

Other transfuncs: spatiallong

Examples

Run this code
x <- c(1, 1, 1, 2, 2, 2, 3, 3, 4)
y <- c(1, 2, 3, 1, 2, 3, 1, 2, 3)
z <- c(3, 4, 2, 3, NA, 5, 6, 3, 1)

spatialwide(x, y, z, digits = 3)

Run the code above in your browser using DataLab