summarize_position: Summary statistics for holdings data

Description Usage Arguments Value Examples

View source: R/posiciones.R

Description

Compute basic summary statistics for holdings data for each strategy, date and id

Usage

1
summarize_position(position, groups = NULL, ...)

Arguments

position

A data.frame object containing holdings information. It is assumed to be generated using get_position

groups

character vector of the names of the variables that will be used with grouping and computing statistics Variable names must be quoted (an inconvenience used to avoid confusion with the commands passed to summarize). If no grouping is desired then it can be set to NULL

...

Commands to be passed to summarize from dplyr for computing statistics within groups #' @details The function will group by investment strategy (carteramodelo), date and asset id and compute basic summary statistics and any other command specified by the user.

Value

A data.frame object with the summary statistics. By default it returns a data.frame indicating the group and columns

Examples

1
2
3
position <- get_position(fecha = c("2016-07-28", "2016-07-29"))
summarize_position(position, groups = c("fecha", "carteramodelo", "id"), count = length(contrato))
summarize_position(position, groups = NULL)

optimist/inhouse documentation built on May 24, 2019, 3:56 p.m.