extendr_api::prelude

Function arr2

Source
pub fn arr2<A, V>(xs: &[V]) -> ArrayBase<OwnedRepr<A>, Dim<[usize; 2]>>
where A: Clone, V: FixedInitializer<Elem = A> + Clone,
Expand description

Create a two-dimensional array with elements from xs.

use ndarray::arr2;

let a = arr2(&[[1, 2, 3],
               [4, 5, 6]]);
assert!(
    a.shape() == [2, 3]
);