I would like to rename my columns in dataframe. Though I am using a ready to use simple rename function under dplyr, I get an error message as shown below. Not sure what is the mistake. Can you please help me?
I have multiple columns but I would like to rename only the 'operator_codes' to 'operator_concept_id' and 'value_codes' to 'value_concept_id'.
oper_val_concepts = function(DF){ DF %>% mutate(Symbol = str_extract(.$value,"[^.\\d]*")) -> df_ope key <- data.frame(Symbol = c("",">","<","-","****","inv","MOD","seen"), operator_codes =c(4172703L,4172704L,4171756L,4172703L,0L,0L,0L,0L), value_codes=c(45884084L,45876384L,45881666L, 45878583L,45884086L,45884086L,45884086L,45884086L)) dfm <-merge(x=df_ope,y=key,by="Symbol",all.x = TRUE) dfm %>% rename(operator_concept_id=operator_codes,value_concept_id=value_codes) #select (-Symbol) } I expect the output dataframe to have the renamed column headings but I get an error message as shown above. Can you please let me know what is the mistake? I can't share the data as it's confidential.

DFon which you apply the function contains columns namedoperator_codesandvalue_codes?dplyr::rename.colnames(df) <- c("a","b","c")