Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as.hyperframe

Convert Data to Hyperframe


Description

Converts data from any suitable format into a hyperframe.

Usage

as.hyperframe(x, ...)

## Default S3 method:
as.hyperframe(x, ...)

## S3 method for class 'data.frame'
as.hyperframe(x, ..., stringsAsFactors=FALSE)

## S3 method for class 'hyperframe'
as.hyperframe(x, ...)

## S3 method for class 'listof'
as.hyperframe(x, ...)

## S3 method for class 'anylist'
as.hyperframe(x, ...)

Arguments

x

Data in some other format.

...

Optional arguments passed to hyperframe.

stringsAsFactors

Logical. If TRUE, any column of the data frame x that contains character strings will be converted to a factor. If FALSE, no such conversion will occur.

Details

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

The generic function as.hyperframe converts any suitable kind of data into a hyperframe.

There are methods for the classes data.frame, listof, anylist and a default method, all of which convert data that is like a hyperframe into a hyperframe object. (The method for the class listof and anylist converts a list of objects, of arbitrary type, into a hyperframe with one column.) These methods do not discard any information.

There are also methods for other classes (see as.hyperframe.ppx) which extract the coordinates from a spatial dataset. These methods do discard some information.

Value

An object of class "hyperframe" created by hyperframe.

Conversion of Strings to Factors

Note that as.hyperframe.default will convert a character vector to a factor. It behaves like as.data.frame.

However as.hyperframe.data.frame does not convert strings to factors; it respects the structure of the data frame x.

The behaviour can be changed using the argument stringsAsFactors.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

df <- data.frame(x=runif(4),y=letters[1:4])
   as.hyperframe(df)

   sims <- replicate(3, runifrect(10), simplify=FALSE)
   as.hyperframe(as.listof(sims))
   as.hyperframe(as.solist(sims))

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.