You can try (if it is a data.frame
)
d1[] <- lapply(colnames(d1), function(x) paste(d1[,x], x, sep="."))
Or
d1[] <- Map(function(x,y) paste(x, y, sep="."), d1, colnames(d1))
If it is a matrix
m1[] <- paste(m1, colnames(m1)[col(m1)],sep=".")
data
m1 <- matrix(1:15, ncol=3, dimnames=list(NULL, LETTERS[1:3]))
d1 <- as.data.frame(m1)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…