R/dt_2_ts_table.R

Defines functions dt_2_ts_table

Documented in dt_2_ts_table

#' Convert data.table to a time series table
#' 
#' This function extract one particular item
#' over time from a data.table that contains
#' multiple items over time. It uses the data.table
#' key to identify relevant columns. 
#' 
#' @param dt a data.table created by \code{\link{calc_shares}}.
#' @param ... varying arguments needed to index over. 
#' @param tindex name of the time index column. 
#' @author Matthias Bannert
#' @seealso \code{\link{calc_shares}}
#' @export
dt_2_ts_table <- function(dt,...,
                        tindex = "time"
){
  
  dt[J(unique(get(tindex)),...)]
  
}
mbannert/gateveys2 documentation built on May 21, 2019, 2:23 p.m.