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

    Interface PivotWiderOptions

    Options for pivotWider (tidyr's arguments in camelCase).

    interface PivotWiderOptions {
        idCols?: string | readonly string[];
        namesFrom?: string | readonly string[];
        namesPrefix?: string;
        namesSep?: string;
        namesSort?: boolean;
        namesVary?: "fastest" | "slowest";
        valuesFill?: DataValue | Readonly<Record<string, DataValue>>;
        valuesFn?: PivotSummary | Readonly<Record<string, PivotSummary>>;
        valuesFrom?: string | readonly string[];
    }
    Index
    idCols?: string | readonly string[]

    The columns that identify a row of the result. Default: every column not in namesFrom or valuesFrom, in the data's order; when given, the other columns are dropped (a column of namesFrom or valuesFrom is an error).

    namesFrom?: string | readonly string[]

    The column (or columns) whose values name the new columns (at least one). Default "name".

    namesPrefix?: string

    Put before each new name. Default "".

    namesSep?: string

    Joins the values of several namesFrom columns, and a value column's name to the name. Default "_".

    namesSort?: boolean

    Sort the names (by the first namesFrom column, then the next) instead of taking them in order of appearance.

    namesVary?: "fastest" | "slowest"

    With several valuesFrom: "fastest" (default) all names for each value column; "slowest" each value column for each name. Any other value is an error, as in tidyr.

    valuesFill?: DataValue | Readonly<Record<string, DataValue>>

    The value of a cell that no row fills, or such values by value column. Default: missing. As in tidyr, it is cast to the type of the value column: a boolean becomes 0 or 1 in a numeric column, 0 and 1 become false and true in a boolean column (NaN missing); any other mix (a string with a number or a boolean) is an error.

    valuesFn?: PivotSummary | Readonly<Record<string, PivotSummary>>

    Summarises the values of each filled cell, or such functions by value column. As in tidyr, the results for one value column take one common type: booleans become 0 and 1 if any result is a number; strings mixed with numbers or booleans are an error.

    valuesFrom?: string | readonly string[]

    The column (or columns) whose values fill the new columns (at least one). Default "value".