longer: pivoting

Description Usage Arguments Value

View source: R/pivoting.R

Description

My own twist on tidyr::pivot_longer and tidyr::pivot_wider, just for convenience

Usage

1
longer(data, cols, names_to, values_to, ...)

Arguments

data

A data frame to pivot.

cols

<tidy-select> Columns to pivot into longer format.

names_to

A string specifying the name of the column to create from the data stored in the column names of data.

Can be a character vector, creating multiple columns, if names_sep or names_pattern is provided. In this case, there are two special values you can take advantage of:

  • NA will discard that component of the name.

  • .value indicates that component of the name defines the name of the column containing the cell values, overriding values_to.

values_to

A string specifying the name of the column to create from the data stored in cell values. If names_to is a character containing the special .value sentinel, this value will be ignored, and the name of the value column will be derived from part of the existing column names.

...

Additional arguments passed on to methods.

Value

data frame


tjebo/tjebtools documentation built on Nov. 15, 2021, 11:21 p.m.