getcolnames_byname: Gets column names

Description Usage Arguments Value Examples

View source: R/Utilities.R

Description

Gets column names in a way that is amenable to use in chaining operations in a functional programming way

Usage

1

Arguments

a

The matrix or data frame from which column names are to be retrieved

Value

column names of m

Examples

1
2
3
4
5
6
7
8
9
m <- matrix(c(1:6), nrow = 2, dimnames = list(paste0("i", 1:2), paste0("c", 1:3))) %>%
  setrowtype("Industries") %>% setcoltype("Commodities")
getcolnames_byname(m)
# This also works for lists
getcolnames_byname(list(m,m))
DF <- data.frame(m = I(list()))
DF[[1,"m"]] <- m
DF[[2,"m"]] <- m
getcolnames_byname(DF$m)

matsbyname documentation built on Oct. 13, 2021, 1:06 a.m.