Skip to main content

scatter_column

Function scatter_column 

Source
#[doc(hidden)]
pub unsafe fn scatter_column( src: SEXP, present_idx: &[usize], n_rows: usize, ) -> SEXP
Expand description

Scatter a typed column SEXP from a dense inner data frame into a new SEXP of length n_rows, placing NA/NULL at rows not in present_idx.

This is called by DataFrameRow-derived enum code to flatten struct-typed variant fields into prefixed columns of the parent data frame.

The output type mirrors the input:

  • REALSXP → REALSXP (NA_real_ fill)
  • INTSXP → INTSXP (NA_integer_ fill)
  • LGLSXP → LGLSXP (NA_logical fill)
  • STRSXP → STRSXP (NA_character_ fill)
  • VECSXP → VECSXP (R_NilValue fill)
  • anything else → VECSXP (R_NilValue fill)

§Safety

Must be called on the R main thread. src must be a valid SEXP of length >= present_idx.len(). n_rows must equal the total row count of the parent data frame.