rmash {tatoo} | R Documentation |
Mash R objects by Rows or Columns
Description
rmash()
and cmash()
are convenience function to mash data.frames
together
with a single command. They behave similar to cbind()
and
rbind()
, just that the result will have have alternating rows/columns.
Usage
rmash(..., rem_ext = NULL, insert_blank_row = FALSE, meta = NULL)
cmash(
...,
rem_ext = NULL,
id_vars = NULL,
suffixes = names(list(...)),
meta = NULL
)
Arguments
... |
either several |
rem_ext |
|
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. |
meta |
A TT_meta object. if supplied, output will also be a Tagged_table. |
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
|
suffixes |
a character vector of length 2 specifying the suffixes to be used for making unique the names of columns. |
Value
A data.table if
any element of (...)
is a data.table
or Tatoo_table,
or if meta
is supplied;
else a data.frame
.
See Also
Examples
dat1 <- data.frame(
x = 1:3,
y = 4:6
)
dat2 <- data.frame(
x = letters[1:3],
y = letters[4:6]
)
rmash(dat1, dat2)
# x y
# 1: 1 4
# 2: a d
# 3: 2 5
# 4: b e
# 5: 3 6
# 6: c f
cmash(dat1, dat2)
# x x y y
# 1: 1 a 4 d
# 2: 2 b 5 e
# 3: 3 c 6 f