I have a dataframe where columns are numneri
asd <- data.frame(`2021`=rnorm(3), `2`=head(letters,3), check.names=FALSE)
But when I reference the columns names as variable, it is returning error
x = 2021
asd[x]
Error in `[.data.frame`(asd, x) : undefined columns selected
Expected output
x = 2021
asd[x]
2021
1 1.5570860
2 -0.8807877
3 -0.7627930