Open
Conversation
| i <- vec_as_location2(i, vec_size(x)) | ||
| .subset2(x, i) | ||
| } else { | ||
| out <- vec_slice(x, i) |
Member
There was a problem hiding this comment.
Use vec_as_location2() on i?
| value <- list(value) | ||
| } | ||
|
|
||
| vec_assign(x, i, value, x_arg = x_arg, value_arg = value_arg) |
Member
There was a problem hiding this comment.
Use vec_as_location2() on i?
This was referenced Aug 19, 2020
Closed
Member
Member
|
Should |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branched from #1226.
Following
vec_chop2()andvec_map(), this further explores the idea of "extracting" variants of vctrs primitives.With atomic vectors,
vec_slice2()andvec_assign2()are equivalent tovec_slice()andvec_assign(). The only difference is thatvec_slice2()zaps the names of the result.vec_slice2()with lists makes use of the list storage requirement and calls.subset2().vec_assign2()with lists wraps the RHS into a list. Genericity is ensured byvec_assign()which coerces the RHS (now a list) to the type of the LHS (a list type). This allows the class of the LHS to initialise attributes, possibly based on the contents of the RHS.One big difference with
[[<-is thatNULLvalues are not treated as a deletion sentinel.There is currently no way to remove elements:
These operations are unexported for now.