rStats.js v1.3.0
    Preparing search index...

    Function merge

    • Join two data frames on key columns. Equivalent to R's merge(). For data frames: every pair of rows of x and y with equal keys (missing keys match each other; key columns of different types are compared in their common type, as R's match: text, or numbers with TRUE as 1), and with allX / allY the rows without a match. Columns: the keys (named as in x; in the common type when rows only in y are kept), x's other columns, y's other columns; a non-key name present in both gets the suffixes. Rows are ordered by the key unless sort is false (several keys: as text joined with "\r" unless allX or allY, as R does); without key columns, the cross join (x varying fastest).

      Parameters

      Returns DataFrame

      const x = { id: [3, 1, 2], v: [10, 20, 30] };
      const y = { id: [1, 2, 2, 4], w: [0.5, 1.5, 2.5, 3.5] };
      merge(x, y); // { id: [1, 2, 2], v: [20, 30, 30], w: [0.5, 1.5, 2.5] }
      merge(x, y, { all: true }); // also id 3 (w missing) and id 4 (v missing)