rray_flip()
reverses the elements of an rray along a single dimension.
rray_flip(x, axis)
x | An rray. |
---|---|
axis | An integer of size |
x
but with reversed elements along axis
.
Dimension names are flipped as well.
x <- rray(1:10, c(5, 2)) x <- rray_set_row_names(x, letters[1:5]) x <- rray_set_col_names(x, c("c1", "c2")) rray_flip(x, 1)#> <rray<int>[,2][5]> #> c1 c2 #> e 5 10 #> d 4 9 #> c 3 8 #> b 2 7 #> a 1 6rray_flip(x, 2)#> <rray<int>[,2][5]> #> c2 c1 #> a 6 1 #> b 7 2 #> c 8 3 #> d 9 4 #> e 10 5