Create a lens into a set of columns

cols_l(cols, drop = FALSE)

Arguments

cols

the columns to focus on

drop

whether or not to drop dimensions with length 1

Examples

x <- matrix(1:4, ncol = 2) colnames(x) <- c("first", "second") x
#> first second #> [1,] 1 3 #> [2,] 2 4
view(x, cols_l(1))
#> first #> [1,] 1 #> [2,] 2
view(x, cols_l("second"))
#> second #> [1,] 3 #> [2,] 4
set(x, cols_l(1), c(20,40))
#> first second #> [1,] 20 3 #> [2,] 40 4