0

I have some columns in a data frame with column names of CO₂.I want to change this to CO2 (no subscripts). How can I do this? in the data table, it reads as CO2 and when I print column names, it reads as CO₂.

I tried following code but it refuses to change.

enter image description here

Quinten
  • 35,235
  • 5
  • 20
  • 53
BRP92K
  • 1
  • 1
    Please share your data using `dput(dataset)`? – Quinten Jun 01 '22 at 17:07
  • looks like duplicate question: https://stackoverflow.com/questions/58007087/replace-subscript-number-in-string – Ganesh Shastry Jun 01 '22 at 17:12
  • 2
    @Quinten I'd strongly advise asking for `dput` of data **subsets**, not whole data. Especially on a question like this that is about the column names, we don't need or want the whole data set. `dput(dataset[1:5, ])` is good--or in this case `dataset` appears to be a `list` so `dput(dataset[[1]][1:5, ])`. – Gregor Thomas Jun 01 '22 at 17:15
  • @GregorThomas, You are completely right, my bad. – Quinten Jun 01 '22 at 17:17

0 Answers0