MergeTables: MergeTables

View source: R/mergetables.R

MergeTablesR Documentation

MergeTables

Description

Merge two or more tables. Bind tables together either by rows (similar to rbind) or by columns (similar to cbind). Unlike those functions, this will attempt to match cases based on the row or column names (similar to merge).

Usage

MergeTables(
  tables,
  direction = c("Side-by-side", "Up-and-down"),
  nonmatching = c("Keep all", "Matching only"),
  override.row.names = "",
  override.column.names = ""
)

Merge2Tables(
  left,
  right,
  direction = c("Side-by-side", "Up-and-down"),
  nonmatching = c("Keep all", "Keep all from first table", "Keep all from second table",
    "Matching only"),
  disambig.names = NULL
)

Arguments

tables

A list of tables to merge

direction

"Side-by-side" is similar to cbind. "Up-and-down" is similar to rbind.

nonmatching

How to handle non-matching row or column names. These are similar to the all.* arguments in merge. MergeTables supports 2 options: "Keep all" (like all = TRUE) and "Matching only" (like all = FALSE). Merge2Tables supports these and a further 2 options: "Keep all from first table" (like all.x = TRUE) and "Keep all from second table" (like all.y = TRUE).

override.row.names

Either a character vector or a single string to be parsed by ConvertCommaSeparatedStringToVector, which will override/replace the default row names of the output table.

override.column.names

Either a character vector or a single string to be parsed by ConvertCommaSeparatedStringToVector, which will override/replace the default column names of the output table.

left, right

The tables to merge. These should be vectors, matrices or arrays. If the array has 3 dimensions, the first 'plane' of the third dimension is kept, the others are dropped. It is an error to have more than 3 dimensions in the array.

disambig.names

Optional vector of column names that should be disambiguated using the table name

Details

If any table has no names for matching, matching is performed based on the index order with the output retaining the names from any table that does have them. In this case the number of columns of the output (for "Up-and-down") is the maximum of the numbers of columns of the inputs.

Functions

  • Merge2Tables(): Merge two tables.


NumbersInternational/flipTables documentation built on Feb. 26, 2024, 6:42 a.m.