EcoGenetics (version 1.2.1-4)

aue.image2df: Transforming a raster into a data frame with cartesian coordinates

Description

This function returns a data frame with the column number (x), row number (y) and cell value (z) of each pixel in a raster.

Usage

aue.image2df(mat, origin = c("upperleft", "lowerleft"),
  out = c("data.frame", "matrix"))

Arguments

mat

Input raster matrix.

origin

Origin of the reference for the coordinates. Default: upperleft.

out

output format: "data.frame" (default) or "matrix".

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
ras <- matrix(eco[["P"]][,1],15,15)
image(ras)
ras.row <- aue.image2df(ras)
ras.row
image(matrix(ras.row[,3], 15, 15))

# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace