grConstruct: Construct Growth rate

Description Usage Arguments Value Examples

View source: R/grConstruct.R

Description

A function for constructing growth rate variables.

Usage

1
2
grConstruct(data, origVar, newVarName = NA, type = c("geo", "ls", "ch"),
  n = 1)

Arguments

data

The data frame containing the data

origVar

The variable in which the growth is to be calculated

newVarName

The name assigned to the new variable, if missing then .SC/.SH/.GR will be appended depending on the type of construction.

type

The type of growth rate, can be least squares or geometric

n

The period for the growth rate to be calculated (Refer to the lsgr or the geogr functions.)

Value

A data frame containing the computed growth rate.

Examples

1
2
3
4
5
6
test.df2 = data.frame(FAOST_CODE = rep(c(1, 5000), each = 5),
                       Year = rep(1990:1994, 2),
                       a = rep(1:5, 2), b = rep(1:5, 2))
grConstruct(test.df2, origVar = "a", type = "geo", n = 1)
grConstruct(test.df2, origVar = "a", type = "geo", n = 3)
grConstruct(test.df2, origVar = "a", type = "geo", n = 5)

FAOSTAT documentation built on May 29, 2017, 10:53 a.m.

Search within the FAOSTAT package
Search all R packages, documentation and source code