/// Removes rows which don't match the given condition from the table.
///
/// Note that after calling this method the order of rows isn't preserved.
Removes rows which don't match the given condition from the table.
Note that after calling this method the order of rows isn't preserved.
Removes rows which don ' t match the given condition from the table . Note that after calling this method the order of rows isn ' t preserved .
pub fn filter<F>(&mut self, f: F) -> usize
    where
        F: Fn(&[f64]) -> bool,
    {
        let mut n = 0;
        let mut i = self.row_range.start;
        while i < self.row_range.end {
            let row_i = self.row_index[i];
            let row = (0..self.columns.len())
                .map(|j| self.columns[j][row_i])
                .collect::<Vec<_>>();
            if f(&row) {
                i += 1;
            } else {
                self.row_index.swap(i, self.row_range.end - 1);
                self.row_range.end -= 1;
                n += 1;
            }
        }
        n
    }
pub fn filter < F > ( & mut self , f : F ) -> usize where F : Fn ( & [ f64 ] ) -> bool , { let mut n = 0 ; let mut i = self . row_range . start ; while i < self . row_range . end { let row_i = self . row_index [ i ] ; let row = ( 0 .. self . columns . len ( ) ) . map ( | j | self . columns [ j ] [ row_i ] ) . collect :: < Vec < _ > > ( ) ; if f ( & row ) { i += 1 ; } else { self . row_index . swap ( i , self . row_range . end - 1 ) ; self . row_range . end -= 1 ; n += 1 ; } } n }
Removes rows which don't match the given condition from the table.
Removes rows which don ' t match the given condition from the table .
&mut self
f
F