Skip to main content

IntoDataFrameSplit

Trait IntoDataFrameSplit 

Source
pub trait IntoDataFrameSplit: Sized {
    // Required method
    fn into_dataframe_split(self) -> List;
}
Expand description

Enum rows → variant-partitioned R data.frames. The split-representation sibling of IntoDataFrame.

Where IntoDataFrame produces one aligned data.frame (field-name union, NA fill for columns a variant doesn’t carry), this verb partitions the rows by variant: each partition is a data.frame with only that variant’s own columns (non-optional types — no NA fill from sibling variants), keyed by the snake_case variant name.

Implemented by #[derive(DataFrameRow)] on an enum row type (for Vec<Row>, via the hidden DataFrameRowSplit bridge below). Struct rows have no variants to partition, so the struct derive does not provide it. Call it on your data: rows.into_dataframe_split().

§Return shape

The returned List is a bare data.frame for a single-variant enum and a named R list of data.frames (one per variant) otherwise. Variants absent from the input still appear as 0-row data.frames with that variant’s column shape; unit variants produce a 0-column data.frame with the correct row count. List is IntoR, so a #[miniextendr] function returns it directly.

Required Methods§

Source

fn into_dataframe_split(self) -> List

Partition the rows by variant into one data.frame per variant.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: DataFrameRowSplit> IntoDataFrameSplit for Vec<T>

Implementors§