expecting column names

Take a look at what happens when one of the outputed columns is used for merging 

## CREATE SAMPLE DATA
#-------------------------------#
  columnNames <- paste0("COL-0", 1:5)  
  silent <- lapply(columnNames, assign, 1:10, envir=.GlobalEnv)
  test <- data.table(cid=LETTERS[1:10], sapply(columnNames, function(x) get(x, envir=parent.frame(2))), key="cid")
  rm(columnNames)
#-------------------------------#


  # find column names with a pattern.  
  #  Also include the key column, cid
  columnNames <- c("cid", names(test)[grep("COL", names(test))])

  # Now, new columns are given names V1...V6, BUT: 
  test[test[, lapply(columnNames, function(x) get(x, envir=parent.frame(2)))]]
    
        cid COL-01 COL-02 COL-03 COL-04 COL-05 V2 V3 V4 V5 V6
     1:   A      1      1      1      1      1  1  1  1  1  1
     2:   B      2      2      2      2      2  2  2  2  2  2
     3:   C      3      3      3      3      3  3  3  3  3  3

   # V1 is merged with cid, and hence no longer its own column. 

This is only a problem when having expected V1 by name as in: 

# ERROR:
test[test[, lapply(columnNames, function(x) get(x, envir=parent.frame(2)))], sum(V1, V2, V3, V4, V5)]

# BUT THIS WORKS: 
test[test[, lapply(columnNames, function(x) get(x, envir=parent.frame(2)))], sum(V2, V3, V4, V5)]

