tolong: Reshape columns into key/value rows

View source: R/primitives.R

tolongR Documentation

Reshape columns into key/value rows

Description

Reshape columns into key/value rows

Usage

tolong(
  data,
  cols,
  names = "variable",
  values = "value",
  idcols = NULL,
  na.rm = FALSE
)

Arguments

data

A data.frame.

cols

Character vector of column names.

names

Name for the resulting key/value column, depending on the function.

values

Vector or list of replacement values.

idcols

Columns to keep as row identifiers.

na.rm

Drop missing values before computing the result.

Value

A long-format basetable.


basetable documentation built on Sept. 18, 2026, 9:13 a.m.