Problem renaming columns with operator in name.

Hello!

I am fairly new to R.

I'm trying to rename a column by using the dplyr rename() function.

The problem is that the column name has an operator in it. To be more precise, the column name is 'USDNOK = X'.

I am able to resolve it by using:
colnames(df)[3] <- "USDNOK"

My question is:
How can I make the rename() function know that the operator is a part of the column name I'm trying to change? And if it's not possible, how can I use brackets inside a pipe?

like:
df %>%
rename(USDNOK=X = USDNOK)

By the way, I have tried several searches without luck. I guess this is a simple task for the person who is trained in R.

Thank you in advance!

df %>% rename( USDNOK =`USDNOK=X`)

Thank you so much! You saved my day :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.