gather_nvec: Gather a named vector into a list

View source: R/utils.R

gather_nvecR Documentation

Gather a named vector into a list

Description

Given a named vector, produce a list that gathers the elements of the vector with the same name into a list where each element takes these unique names.

Usage

gather_nvec(vec)

Arguments

vec

Named vector

Value

List with elements being a unique name in the input vector

Author(s)

John Best

Examples

vec <- c(1, 1, 1, 1, 2, 2, 2, 3, 3, 4)
names(vec) <- c("a", "a", "a", "a", "b", "b", "b", "c", "c", "d")
gather_nvec(vec)


jkbest2/spatq documentation built on Sept. 22, 2022, 3:22 a.m.