I have just imported data where one of the column names is "repeat." If I try to reference the column via data$repeat
, I get an error Error: unexpected 'repeat' in "data$repeat".
The same problem happens when I reference repeat
inside of a linear regression.
How can I reference a column with a reserved word in order to either change the column or use it in a linear regression?
data <- data.frame('repeat' = 1, 'break' = 2, check.names = FALSE)
data
# repeat break
# 1 1 2
data$repeat
Error: unexpected 'repeat' in "data$repeat"
Use this syntax to select column "repeat"
:
data$`repeat`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With