as.data.table.Mashed_table: Convert a Mashed Table to a data.table or data.frame

View source: R/Mashed_table.R

as.data.table.Mashed_tableR Documentation

Convert a Mashed Table to a data.table or data.frame

Description

Convert a Mashed Table to a data.table or data.frame

Usage

## S3 method for class 'Mashed_table'
as.data.table(
  x,
  keep.rownames = NULL,
  ...,
  mash_method = attr(x, "mash_method"),
  insert_blank_row = attr(x, "insert_blank_row"),
  id_vars = attr(x, "id_vars"),
  suffixes = names(x)
)

## S3 method for class 'Mashed_table'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  ...,
  mash_method = attr(x, "mash_method"),
  insert_blank_row = attr(x, "insert_blank_row"),
  id_vars = attr(x, "id_vars"),
  suffixes = names(x)
)

Arguments

x

a Mashed_table

keep.rownames

ignored

...

passed on to as.data.table() or as.data.frame() respectively

mash_method

either "row" or "col". Should the tables be mashed together with alternating rows or with alternating columns?

insert_blank_row

Only if mashing rows: logical. Whether to insert blank rows between mash-groups. Warning: this converts all columns to character. Use with care.

id_vars

Only if mashing columns: one ore more colnames of the tables to be mashed. If supplied, columns of both input tables are combined with merge(), otherwise cbind() is used.

suffixes

a character vector of length 2 specifying the suffixes to be used for making unique the names of columns.

row.names

ignored

optional

logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method.

Value

a data.table or data.frame


tatoo documentation built on March 31, 2023, 8:16 p.m.