minigather: Simple function to gather (reshape) data.

Description Usage Arguments Value Note Examples

View source: R/utils.R

Description

Simple function to gather (reshape) data.

Usage

1
2
3
4
5
6
7
minigather(
  x,
  gather_cols,
  category_col_name,
  value_col_name,
  new_categories = NULL
)

Arguments

x

Data frame to reshape

gather_cols

Names of columns to gather, character vector

category_col_name

Name of resulting category column, character

value_col_name

Name of resulting value column, character

new_categories

Optional new categories to use in place of gathered column names, character vector

Value

The data frame in long format.

Note

Base R's reshape sucks, while gather brings in tidyr, which in turn imports dplyr, ...way too heavy.

Examples

1
cosore:::minigather(cars, c("speed", "dist"), "var", "val")

bpbond/cosore documentation built on July 20, 2021, 3:17 p.m.