export-methods: Coerce from Fields and Comparisons

export-methodsR Documentation

Coerce from Fields and Comparisons

Description

Functions to coerce Fields and Comparisons into other objects (data.frame, data.table, Raster* objects)

Usage

## S3 method for class 'Field'
as.data.frame(x, row.names, optional, ...)

## S3 method for class 'Comparison'
as.data.frame(x, row.names, optional, ...)

## S3 method for class 'Field'
as.data.table(x, keep.rownames, ...)

## S3 method for class 'Comparison'
as.data.table(x, keep.rownames, ...)

as.Raster(x)

## S4 method for signature 'Field'
as.Raster(x)

## S4 method for signature 'Comparison'
as.Raster(x)

as.SpatRaster(x)

as.SpatRasterDataset(x)

## S4 method for signature 'Field'
as.SpatRaster(x)

## S4 method for signature 'Field'
as.SpatRasterDataset(x)

## S4 method for signature 'Comparison'
as.SpatRasterDataset(x)

as.array(x, ...)

## S4 method for signature 'Field'
as.array(x, ...)

Arguments

x

A Field or a Comparison object

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional).

...

Just as ... in data.frame. Usual recycling rules are applied to vectors of different lengths to create a list of equal length vectors.

keep.rownames

If ... is a matrix or data.frame, TRUE will retain the rownames of that object in a column named rn.

Details

Note that for coercing to a Raster* object (RasterLayer or RasterBrick) the function is called "as.Raster" (capital "R") to avoid conflict with another function in the raster package called "as.raster"

Value

Either a single array or a list of arrays, depending on if the input Field had one layer or multiple layers

Author(s)

Matthew Forrest matthew.forrest@senckenberg.de, Joerg Steinkamp joerg.steinkamp@senckenberg.de


MagicForrest/DGVMTools documentation built on Aug. 23, 2024, 8:05 a.m.