gather_variables: Gathers multiple variables.

Description Usage Arguments Value Examples

View source: R/gather_variables.R

Description

gather_variables gathers variables from a particularly formated dataframe. View examples for details.

Usage

1
2
gather_variables(x, start = 2, end = length(x), timeInd = 1,
  entity.position = "before")

Arguments

x

A dataframe.

start

Column index of where variables to be gathered starts

end

Column index of where variables to be gathered ends

timeInd

Column index of time variable

entity.position

Before or After. Are the entity names before or after the seperator in the variable names?

Value

A long tidy dataframe of x with entities merged into one variable.

Examples

1
2
3
4
df <- data.frame(x = 2010:2018, CAN_Bonds = runif(9), US_Bonds = runif(9),
CAN_Debt = rnorm(9, 100, 30), US_Debt = rnorm(9, 100, 30))

gather_variables(df)

faouser1/FAO documentation built on Nov. 4, 2019, 12:35 p.m.