I do not recommend working with column names starting with numbers, but if you insist, use the check.names=FALSE data.frame :
qcCtrl <- data.frame("2D6"="DNS00012345", "3A4"="DNS000013579", check.names=FALSE) qcCtrl 2D6 3A4 1 DNS00012345 DNS000013579
One of the reasons I'm warning about this is because the $ operator becomes more complex to work with. For example, the following failure occurs with an error:
> qcCtrl$2D6 Error: unexpected numeric constant in "qcCtrl$2"
To get around this, you must attach your column name in the reverse tick when you work with it:
> qcCtrl$`2D6` [1] DNS00012345 Levels: DNS00012345
source share