As others have said, you must first name the data frame. (Although there is a way to avoid this, stay tuned.) But you already knew this and wanted to know why. Here it is.
, , - . " ", . . :
fooobar.com/questions/57282/....
, .
names(d) <- c("A","B")
d <- `names<-`(d, c("A","B"))
( cbind out)
tmp <- cbind(LETTERS[1:3],1:3)
data.frame(tmp) <- `names<-`(data.frame(tmp), c("A","B"))
tmp <- `data.frame<-`(tmp, `names<-`(data.frame(tmp), c("A","B")))
, data.frame<-.
, , names<-, , .
`names<-`(data.frame(tmp), c("A","B"))