df.to.mat: Change xyz data-frame into a Z image

View source: R/EFDR_functions.R

df.to.matR Documentation

Change xyz data-frame into a Z image

Description

Given a data frame with fields x, y and z, df.to.mat uses the x and y coordinates to rearrange z into a rectangular matrix image Z.

Usage

df.to.mat(df)

Arguments

df

data frame with fields x, y and z

Details

This function requires that all pixels in the image are defined, that is df$x and df$y must be the column outputs of the function expand.grid(x0,y0) where x0, y0 are axes values. Note that x0 and y0 do not need to be regularly spaced.

Value

matrix image

Examples

df <- data.frame(expand.grid(1:10,1:10))
names(df) <- c("x","y")
df$z <- rnorm(nrow(df))
Z <- df.to.mat(df)

EFDR documentation built on Aug. 23, 2023, 1:07 a.m.