Skip to content

Commit

Permalink
fix: add split_at function
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbass committed Dec 18, 2023
1 parent b165dfc commit a347da3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,8 @@ collapse_list <- function(x){
}
x
}

#' Split vector by position
#' @note From https://stackoverflow.com/questions/16357962/r-split-numeric-vector-at-position
#' @noRd
split_at <- function(x, pos) unname(split(x, cumsum(seq_along(x) %in% pos)))

0 comments on commit a347da3

Please sign in to comment.