subset.time.table: Subset a time table

Description Usage Arguments Details

View source: R/time.table.R

Description

Subset a time table rows and columns by expression or indices, preserving time.table structure.

Usage

1
2
3
## S3 method for class 'time.table'
subset(tt, expr = NULL, vars = NULL, index = NULL,
  times = NULL, preserve.frequency = NULL)

Arguments

tt

time.table to subset

expr

Expression evaluated within tt to subset the rows of tt

vars

Non-index/time columns to subset

index

data.table/data.frame containing indices or indices and times to subset

times

times within each index to subset (to not specify if index already contains times to extract!)

preserve.frequency

whether to preserve (or reguess) frequency information after subsetting

Details

Note that for now vars *must* be a collection of strings.

One can specify more than one of expr, vars, and index/time, in which case the time.table is first subset by index/time, then by expr and finally by vars, meaning index/expr can rely on variables removed after the subset. Note that this can result in unexpected behaviour if expr evaluates to a vector of row numbers.

Furthermore both vars and expr can mention extra columns in index/time (merged in the intermediate data.table in the index step).

If a column name exists in both tt and index/time then the name will referr to the corresponding column of tt *if* the column is to be kept (i.e. it is in vars), else it will refer to the merged value from index/time.


rossklin/timetablr documentation built on May 27, 2019, 11:40 p.m.