towide: Reshape rows into columns

View source: R/primitives.R

towideR Documentation

Reshape rows into columns

Description

Reshape rows into columns

Usage

towide(data, names, values, idcols = NULL, fun = NULL, fill = NA)

Arguments

data

A data.frame.

names

Column whose values become the new column names.

values

Column whose values fill the new columns.

idcols

Columns to keep as row identifiers. Defaults to every column other than names and values.

fun

Function that reduces the values falling in one cell. When NULL (the default), each cell takes its single value; if any cell holds more than one value, cells are counted with length() and a message says so.

fill

Value used for cells with no matching row.

Value

A wide-format basetable.


basetable documentation built on Nov. 14, 2026, 1:08 a.m.