struct
Table
pub struct Table {
pub columns: Vec<Column>,
pub rows: Vec<Value>,
pub meta: Meta,
pub geometry: Option<Rc<Vec<Option<Shape>>>>,
}Data read from a source: its columns and rows (records), with what the source says about it.
Fields
Methods
apply
pub fn apply(&mut self, incoming: Table, how: Update, key: Option<&str>, keep: Option<usize>)Apply a message's rows. Later rows take the types the table already has: a "12.3" in a number column is a number.
from_text
pub fn from_text(headers: &[String], rows: Vec<Vec<String>>, missing: &[String]) -> TableFrom header names and rows of text (CSV).
from_records
pub fn from_records(records: Vec<Value>, missing: &[String]) -> TableFrom records (JSON). Nested records become country.value columns.
apply_labels
pub fn apply_labels(&mut self, _: &Table)Without the stats feature a codebook can't be asked for.
to_csv
pub fn to_csv(&self) -> StringThe visible columns as CSV. A cell starting like a spreadsheet formula is quoted so that opening the file can't run it.
set_labels
pub fn set_labels(&mut self, keys: &[String], labels: &[Option<String>])Give columns their names to show (surveys' question text).
status
pub fn status<'a>(row: &'a Value, key: &str) -> Option<&'a str>Why a row's cell has no value (np, ..), if the source said.
varying_dimensions
pub fn varying_dimensions(&self) -> Vec<&Column>Dimensions with more than one value: if a chart doesn't split or filter on these, it would draw different things as one series.
filter
pub fn filter(&mut self, wanted: &BTreeMap<String, Value>)Keep rows matching every key: value (a list means any of them).
group
pub fn group(&mut self, by: &str, how: &str)One row per distinct by value, each number column combined with how (sum, mean, count, min, max). Cells with no value aren't counted, and the table's notes say how many were left out.
group_within
pub fn group_within(&mut self, by: &str, within: &[String], how: &str)[Table::group], keeping these columns apart too: a value per by within each of them.