Tables

DiffinDiffsBase.TableIndexedMatrixType
TableIndexedMatrix{T,M,R,C} <: AbstractMatrix{T}

Matrix with row and column indices that can be selected based on row values in a Tables.jl-compatible table respectively. This is useful when how elements are stored into the matrix are determined by the rows of the tables.

Parameters

  • T: element type of the matrix.
  • M: type of the matrix.
  • R: type of the table paired with the row indices.
  • C: type of the table paired with the column indices.

Fields

  • m::M: the matrix that stores the elements.
  • r::R: a table with the same number of rows with m.
  • c::C: a table of which the number of rows is equal to the number of columns of m.
DiffinDiffsBase.VecColumnTableType
VecColumnTable <: AbstractColumns

A Tables.jl-compatible column table that stores data as Vector{AbstractVector} and column names as Vector{Symbol}. Retrieving columns by column names is achieved with a Dict{Symbol,Int} that maps names to indices.

This table type is designed for retrieving and iterating dynamically generated columns for which specialization on names and order of columns are not desired. It is not intended to be directly constructed for interactive usage.

DiffinDiffsBase.applyMethod
apply(d, by::Pair)

Apply a function elementwise to the specified column(s) in a Tables.jl-compatible table d and return the result.

Depending on the argument(s) accepted by a function f, it is specified with argument by as either column_index => f or column_indices => f where column_index is either a Symbol or Int for a column in d and column_indices is an iterable collection of such indices for multiple columns. f is applied elementwise to each specified column to obtain an array of returned values.

DiffinDiffsBase.apply_and!Method
apply_and!(inds::BitVector, d, by::Pair)
apply_and!(inds::BitVector, d, bys::Pair...)

Apply a function that returns true or false elementwise to the specified column(s) in a Tables.jl-compatible table d and then update the elements in inds through bitwise and with the returned array. If an array instead of a function is provided, elementwise equality (==) comparison is applied between the column and the array. See also apply_and.

The way a function is specified is the same as how it is done with apply. If multiple Pairs are provided, inds are updated for each returned array through bitwise and.

DiffinDiffsBase.apply_andMethod
apply_and(d, by::Pair)
apply_and(d, bys::Pair...)

Apply a function that returns true or false elementwise to the specified column(s) in a Tables.jl-compatible table d and return the result. If an array instead of a function is provided, elementwise equality (==) comparison is applied between the column and the array. See also apply_and!.

The way a function is specified is the same as how it is done with apply. If multiple Pairs are provided, the returned array is obtained by combining arrays returned by each function through bitwise and.

DiffinDiffsBase.subcolumnsFunction
subcolumns(data, names, rows=Colon(); nomissing=true)

Construct a VecColumnTable from data using columns specified with names over selected rows.

By default, columns are converted to drop support for missing values. When possible, resulting columns share memory with original columns.