I am creating a simple data frame like this:
qcCtrl <- data.frame("2D6"="DNS00012345", "3A4"="DNS000013579")
My understanding is that the column names should be “2D6” and “3A4”, but they are actually “X2D6” and “X3A4”. Why are the X’s being added and how do I make that stop?
I do not recommend working with column names starting with numbers, but if you insist, use the
check.names=FALSEargument ofdata.frame:One of the reasons I caution against this, is that the
$operator becomes more tricky to work with. For example, the following fails with an error:To get round this, you have to enclose your column name in back-ticks whenever you work with it: