Learn R Programming

futile.any (version 1.3.2)

anytypes: Get the useful types of a data structure

Description

This function consolidataes data sets within lists and two dimensional data. Like anylength the idea is to unify the accessors for various data structures with a single common interface.

Usage

anytypes(...)

Arguments

...
Abstract function controlled by lambda.r

Value

The types or classes of a data structure

Details

anytypes(data, fun = class) data - An object fun - The function to use to get the types. Defaults to class, although type or mode, etc. could be used

Depending on the type of structure utilized in code, one needs to call either names or colnames to get information related to the data sets within the structure. The use of two separate functions can cause errors and slows development time as data structures passed from intermediate functions may change over time, resulting in a broken interface.

By providing a thin layer over underlying accessors, this function attempts to expedite development and add a bit of polymorphism to the semantics of names. The explicit assumption is that data sets in two dimensional structures are organized by column, as this is compatible with time-series objects such as zoo and xts.

See Also

anynames

Examples

Run this code
  d <- data.frame(ints=c(1,2,3), chars=c('a','b','c'), nums=c(.1,.2,.3))
  anytypes(d)

Run the code above in your browser using DataLab