Skip to main content

Module dataframe

Module dataframe 

Source
Expand description

Runtime wrapper for R data.frame objects.

Provides DataFrameView, a typed wrapper around an R data.frame SEXP backed by NamedList for O(1) column access by name. This complements the existing DataFrame<T> which handles row-to-column transposition for creating data frames; DataFrameView is for receiving and inspecting them.

§Example

use miniextendr_api::dataframe::DataFrameView;
use miniextendr_api::typed_list::{TypedListSpec, TypedEntry, TypeSpec};

#[miniextendr]
fn summarize(df: DataFrameView) -> f64 {
    let x: Vec<f64> = df.column("x").unwrap();
    x.iter().sum()
}

Structs§

DataFrameView
A validated R data.frame backed by NamedList for O(1) column access.

Enums§

DataFrameError
Error returned when constructing or validating an DataFrameView.

Functions§

extract_nrow 🔒
Extract nrow from R’s row.names attribute.
nrow_from_first_column 🔒
Fall back: extract nrow from the length of the first column.
validate_equal_lengths 🔒
Validate that all columns in a NamedList have equal length, returning the common length.