acum_p: Transform variables in percentage in variables in accumulate...

Description Usage Arguments Value Author(s) Examples

View source: R/acum_p.R

Description

Given vector with variable in percentage the function creates a vector with the variable in accumulated percentage.

Usage

1

Arguments

data

Numeric variable in percentage

n

Number of periods to accumulate

Value

A numeric vector in accumulated percentage.

Author(s)

J. Renato Leripio

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 

library(tidyverse)
library(tstools)

data <- tibble(Date = seq.Date(from = as.Date("2012-01-01"),
                               to = as.Date("2018-06-01"),
                               by = "month"),
               V1 = rnorm(mean = 0, sd = 1, n = 78),
               V2 = rnorm(mean = 1, sd = 2, n = 78),
               V3 = rnorm(mean = 5, sd = 1, n = 78))

data_acum <- dplyr::mutate(data, V1_acum12 = acum_p(V1, 12))
              
## End(Not run)

leripio/tstools documentation built on Aug. 1, 2019, 12:52 p.m.