R/list_remove.R

Defines functions list_remove

Documented in list_remove

#' Remove elements from a list.
#'
#' @param in_list The list to remove elements from.
#' @param ... Names or numeric positions of elements to remove.
#'
#' @return The list with the specified elements removed.
#' @export
#'
#' @examples
#' my_list <- list(a = rnorm(10), b = rnorm(10), c = rnorm(10))
#' list_remove(my_list, b)
list_remove <- function(in_list, ...) {
    selection <- selection(in_list, c(...))
    in_list[-selection]
}

Try the listr package in your browser

Any scripts or data that you put into this service are public.

listr documentation built on Oct. 6, 2022, 5:11 p.m.