I want to cbind a data.table and a vector in such a way that the vector contents becomes new columns for the data.table with zero values.
DT <- data.table(x=c("A", "B", "C", "D", "E", "F"), y = rnorm(6))
DT2 <- c("paper11grid1", "paper12grid1", "paper13grid1")
I want to to update the contents of DT2 as new coumnnames of DT
x y paper11grid1 paper12grid1 paper13grid1
A 0.9643131 0 0 0
B -0.8856350 0 0 0
C -0.1489705 0 0 0
D 2.0675105 0 0 0
E -1.2965938 0 0 0
F -0.8468514 0 0 0
A cbind directly will just add the DT2 as one coumn
cbind(DT, DT2)