Skip to content

Commit

Permalink
Add vec_init() example with lists for tidyverse/dplyr#7076
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Aug 27, 2024
1 parent cf0e08b commit 8d98911
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/slice.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ vec_index <- function(x, i, ...) {
#' @examples
#' vec_init(1:10, 3)
#' vec_init(Sys.Date(), 5)
#'
#' # The "missing" value for a data frame is a row that is entirely missing
#' vec_init(mtcars, 2)
#'
#' # The "missing" value for a list is `NULL`
#' vec_init(list(), 3)
vec_init <- function(x, n = 1L) {
.Call(ffi_init, x, n, environment())
}
Expand Down
5 changes: 5 additions & 0 deletions man/vec_init.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d98911

Please sign in to comment.