as_Composite_table: Coerce to Composite Table

Description Usage Arguments Value Examples

View source: R/Composite_table.R

Description

Converts other R objects to Composite_tables by automatically creating multi-column names from the properties of the objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
as_Composite_table(x, ...)

## S3 method for class 'Mashed_table'
as_Composite_table(x, id_vars = attr(x,
  "id_vars"), meta = attr(x, "meta"), ...)

## S3 method for class 'data.frame'
as_Composite_table(x, sep = ".", reverse = FALSE,
  ...)

is_Composite_table(x, ...)

Arguments

x

Any R object.

...

Ignored

id_vars

If id_vars is specified, the tables will be combined using merge() on the columns specified in id_vars, otherwise the tables will be combined with cbind().

meta

a TT_meta object. If specified, the resulting Composite_table will be wrapped in a Tagged_table.

sep

a scalar character. Separator in the column names of x that separates the column name from the multi-column name.

reverse

logical. if FALSE the part after the last occurrence of sep will be used as multiname, if TRUE the part before will be used.

Value

as_Composte_table() returns a Composite_table

is_Composite_table returns TRUE if its argument is a Composite_table and FALSE otherwise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
mash_table(
  head = head(cars),
  tail = tail(cars),
  mash_method = 'col'
)


as_Composite_table(data.frame(
  apple.fruit = 1,
  kiwi.fruit = 2,
  dog.animal = 1,
  black.cat.animal = 2,
  parrot.animal = 3
))

tatoo documentation built on May 1, 2019, 9:52 p.m.