I have 4 duplicate column names in my dataframe. When I read the file, R automatically appends .1 or .2 to my duplicate columns Original table -
Date Temp Press Probability Press Probability
11/4/2015 100 45 0.65 55 0.85
What R is currently doing -
Date Temp Press Probability Press.1 Probability.1
11/4/2015 100 45 0.65 55 0.85
I don't want R to add .1 to my duplicate columns. Is there a way I can avoid that and keep my parameter name as-is? Please advise Thanks
When calling data.frame()
, you can specify the parameter check.names = FALSE
. Like in :
data.frame(foo = 1:3, foo = 2:4, check.names = FALSE)
However, it is often better to avoid duplicates in column names.
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