Function rustplot::data_parser::vec_num_transform [] [src]

pub fn vec_num_transform(
    vec1: &Vec<f64>,
    trans_func: fn(_: f64) -> f64
) -> Vec<f64>

Performs a specified numerical transformation on each element of a Vec<f64>.

vec1 is the vector to be transformed.

trans_func is the transformation function applied to each element of the vector.

Examples

use rustplot::data_parser;

let num_row = data_parser::get_num_row(0, 0, 10, "./test.csv");

fn transform(num1: f64) -> f64 {
    num1 + 10.0
}
let f: fn(f64) -> f64 = transform;

let new_vec = data_parser::vec_num_transform(&num_row, f);