dgkf / dgkf/R

How to treat vector-assignment to list

Open
#186 0 comments 0 reactions 0 assignees View on GitHub
status-feedback-needed theme-base
Dominant language
Rust
Stars
145
Forks
5
PR merge metrics
No merged PRs in 30d

Description

In R, assigining a vector to a list-slice vectorizes:

``` r
l = list(1, 2, 3); l[1:2] = 10:11; l
#> [[1]]
#> [1] 10
#>
#> [[2]]
#> [1] 11
#>
#> [[3]]
#> [1] 3
```

Created on 2024-10-05 with [reprex v2.1.1](https://reprex.tidyverse.org)

I am not sure whether I think this is the desireable behavior. Maybe this should instead recycle the `10:11` into a `list(10:11, 10:11)` and then perform the assignment. This would then result in a `list(10:11, 10:11, 3)` instead of `list(10, 11, 3)` as above.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.