Displaying 1 result from an estimated 1 matches for "vec_slice".
Did you mean:
vec_size
2018 Nov 06
0
An update on the vctrs package
...rs even
though `NROW(mean)` is `1`.
``` r
vec_size(1:10)
#> [1] 10
vec_size(as.POSIXlt(Sys.time() + 1:10))
#> [1] 10
vec_size(data.frame(x = 1:10))
#> [1] 10
vec_size(array(dim = c(10, 4, 1)))
#> [1] 10
vec_size(mean)
#> Error: `x` is a not a vector
```
`vec_size()` is paired with `vec_slice()` for subsetting, i.e.
`vec_slice()` is to `vec_size()` as `[` is to `length()`;
`vec_slice(data.frame(x), i)` equals `data.frame(vec_slice(x, i))`
(modulo variable/row names).
(I plan to make `vec_size()` and `vec_slice()` generic in the next
release, providing another point of differentiation f...