hyperframe {spatstat.geom}R Documentation

Hyper Data Frame

Description

Create a hyperframe: a two-dimensional array in which each column consists of values of the same atomic type (like the columns of a data frame) or objects of the same class.

Usage

   hyperframe(...,
             row.names=NULL, check.rows=FALSE, check.names=TRUE,
             stringsAsFactors=NULL)

Arguments

...

Arguments of the form value or tag=value. Each value is either an atomic vector, or a list of objects of the same class, or a single atomic value, or a single object. Each value will become a column of the array. The tag determines the name of the column. See Details.

row.names, check.rows, check.names, stringsAsFactors

Arguments passed to data.frame controlling the names of the rows, whether to check that rows are consistent, whether to check validity of the column names, and whether to convert character columns to factors.

Details

A hyperframe is like a data frame, except that its entries can be objects of any kind.

A hyperframe is a two-dimensional array in which each column consists of values of one atomic type (as in a data frame) or consists of objects of one class.

The arguments ... are any number of arguments of the form value or tag=value. Each value will become a column of the array. The tag determines the name of the column.

Each value can be either

All columns (vectors, factors and lists) must be of the same length, if their length is greater than 1.

Value

An object of class "hyperframe".

Methods for Hyperframes

There are methods for print, plot, summary, with, split, [, [<-, [[, [[<-, $, $<-, names, as.data.frame as.list, cbind and rbind for the class of hyperframes. There is also is.hyperframe and as.hyperframe.

Handling Character Strings

The argument stringsAsFactors is a logical value (passed to data.frame) specifying how to handle pixel values which are character strings. If TRUE, character values are interpreted as factor levels. If FALSE, they remain as character strings. The default values of stringsAsFactors depends on the version of R.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner rolfturner@posteo.net

See Also

as.hyperframe, as.hyperframe.ppx, plot.hyperframe, [.hyperframe, with.hyperframe, split.hyperframe, as.data.frame.hyperframe, cbind.hyperframe, rbind.hyperframe

Examples

 # equivalent to a data frame
  hyperframe(X=1:10, Y=3)

 # list of functions
  hyperframe(f=list(sin, cos, tan))

 # table of functions and matching expressions
  hyperframe(f=list(sin, cos, tan),
             e=list(expression(sin(x)), expression(cos(x)), expression(tan(x))))

  hyperframe(X=1:10, Y=letters[1:10], Z=factor(letters[1:10]),
    stringsAsFactors=FALSE)

  lambda <- runif(4, min=50, max=100)
if(require(spatstat.random)) {
  X <- solapply(as.list(lambda), rpoispp)
} else {
  X <- solapply(as.list(lambda), function(lam) runifrect(rpois(1, lam)))
}
  h <- hyperframe(lambda=lambda, X=X)
  h

  h$lambda2 <- lambda^2
  h[, "lambda3"] <- lambda^3
  h[, "Y"] <- X

  h[[2, "lambda3"]]

[Package spatstat.geom version 3.2-9 Index]