gather_one: Gather one variable set from wide to long

Description Usage Arguments Value Examples

View source: R/padis_general_functions.R

Description

Gather one variable set from wide to long

Usage

1
2
gather_one(data, key_vars, varying, keep_others = FALSE, new_name = NULL,
  show_origin = FALSE)

Arguments

data

The data frame that contains the variables

key_vars

The key-variables or id variables that should be the grouping variables in the long format

varying

The variables that vary and should be stacked in the long format

keep_others

If TRUE, all other variables of the data frame are kept as well and stacked in the long format

new_name

The new name of the stacked variable in the long format

show_origin

Logical, if TRUE, and additional variable will be created showing from which variables the values originated. Default is to FALSE.

Value

Returns a data frame in long format

Examples

1
gather_one(data=wide_example_data, key_vars = "id", varying = c("var_p_1", "var_p_2"), new_name = "var")

kthorstmann/padis documentation built on May 24, 2019, 5:01 a.m.