Last data update: 2014.03.03

R: Futile library to provide some polymorphism
futile.any-packageR Documentation

Futile library to provide some polymorphism

Description

This package contains a collection of utility functions that provide polymorphism over certain data types. These any* functions attempt to consolidate attribute access of lists, vectors, matrices, arrays, and other data structures.

Details

Package: futile.any
Type: Package
Version: 1.3.2
Date: 2015-07-06
License: LGPL-3
LazyLoad: yes

The anylength and anynames functions consolidate attribute access across many data structures providing a bit of convenience via polymorphism. The anytypes function provides the classes or types of a data.frame-like object. This is useful when parsing data and it is not always clear how values will be parsed.

Author(s)

Brian Lee Yung Rowe <r@zatonovo.com>

See Also

anylength, anynames, anytypes

Examples

  m <- matrix(c(1,2,3,4,5,6), ncol=2)
  anylength(m)

  v <- c(1,2,3,4,5)
  anylength(v)

  m <- matrix(c(1,2,3,4,5,6), ncol=2)
  anynames(m) <- c('d','e')
  anynames(m)

  v <- c(a=1,b=2,c=3,d=4,e=5)
  anynames(v)

  l <- list(a=1,b=2,c=3,d=4,e=5)
  anynames(l)

Results