Indexing with negative values is not supported yet
- Dominant language
- Rust
- Stars
- 145
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Just to document this, it is currently not possible to index vectors with negative values
```r
> x = 1:10
[1] 1 2 3 4 5 6 7 8 9 10
> x[-1]
double(0)
```
In `R`, it is possible to index with negative values to exclude them:
```r
> x = 1:10
> x[-1]
[1] 2 3 4 5 6 7 8 9 10
>
```
When implementing this feature it is important to pay attention to now allow mixing positive and negative indices, this even throws an error in R:
```r
> x[c(-1, 2)]
Error in x[c(-1, 2)] : only 0's may be mixed with negative subscripts
> x[c(-1, 0)]
[1] 2 3 4 5 6 7 8 9 10
>
```
I don't quite understand why indexing with `0` is allowed, but as we generally throw an error when using out-of bound indices this is nothing we should have to worry about.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.