pub type RColumn<T> = RArray<T, 1>;Aliased Type§
pub struct RColumn<T> {
robj: Robj,
_data: PhantomData<T>,
}Fields§
§robj: RobjOwning Robj (probably should be a Pin).
_data: PhantomData<T>Data type of the n-array
Implementations§
Source§impl<T> RColumn<T>
impl<T> RColumn<T>
Sourcepub fn new_column<F: FnMut(usize) -> T>(nrows: usize, f: F) -> Self
pub fn new_column<F: FnMut(usize) -> T>(nrows: usize, f: F) -> Self
Make a new column type.
Sourcepub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter(&self) -> impl Iterator<Item = &T>
Returns an iterator over the elements of the column.
This method is experimental and likely to be unstable for a while.
use extendr_api::prelude::*;
test! {
let col = RColumn::new_column(3, |r| [1., 2., 3.][r]);
let sum = col.iter().sum::<f64>();
assert_eq!(sum, 6.);
}