How can I select all columns in a matrix without some subset of columns (by name)?
Here I would like to select all but foo
m = as.matrix(1:4)
dim(m) <- c(2,2)
colnames(m) = c('foo', 'bar')
foo bar
[1,] 1 3
[2,] 2 4
m[, all-but-`foo`] # ???
In the real script my matrix has many columns and I would like to select all of them but one or two. I do not want to specify explicitly the columns I want to select, by rather those that I don't want at the output.