as.data.frame.enumeration: Creates a data.frame with all elements of an enum

Description Usage Arguments Value Examples

View source: R/as_data_frame_enumeration.R

Description

The data.frame is useful for debugging purposes, filling list and combo boxes in user interfaces to select one value etc.

Usage

1
2
3
## S3 method for class 'enumeration'
as.data.frame(x, row.names = NULL, optional = FALSE,
  ...)

Arguments

x

An object of class "enumeration" (created with create.enum)

row.names

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

optional

Currently not used (but required for a compatible S3 interface)

...

Currently not used (but required for a compatible S3 interface)

Value

A data.frame with three columns: allowed.values, value.names and descriptions. The 'descriptions' column is set to the names attribute of the enum if no 'descriptions' attribute exists. Character strings are never converted to factors (stringsAsFactors = FALSE).

Examples

1
2
3
DRINKS <- create.enum(c(COFFEE = 1, TEA = 2, SOFT_DRINK = 3),
                      descriptions = c("hot", "hotter", "cold"))
as.data.frame(DRINKS)

aryoda/R_enumerations documentation built on Nov. 7, 2017, 7:12 a.m.