Learn R Programming

spatstat.geom (version 3.3-2)

as.data.frame.im: Convert Pixel Image to Data Frame

Description

Convert a pixel image to a data frame

Usage

# S3 method for im
as.data.frame(x, ...)

Value

A data frame.

Arguments

x

A pixel image (object of class "im").

...

Further arguments passed to as.data.frame.default to determine the row names and other features.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

Details

This function takes the pixel image x and returns a data frame with three columns containing the pixel coordinates and the pixel values.

The data frame entries are automatically sorted in increasing order of the x coordinate (and in increasing order of y within x).

Examples

Run this code
   # artificial image
   Z <- setcov(square(1))

   Y <- as.data.frame(Z)

   head(Y)

Run the code above in your browser using DataLab