dplyr and colnames after using left join

Hello,
I am bit confused using the colnames or names command.
I applied a lef joing employing dplyr.
I assign the colnames as:
colnames(t1_f)=c("Co","Eleg","Nole","Rate(%)")

But when I print t1_f using the console or View(t1_f), I see that the last column is listed as:

..."Rate(%)"$n.y)`

I leave this information If It is any use:

class(t1_f) [1] "tbl_df" "tbl" "data.frame"

Thanks for your time and interest, community.

Did you perform another operation after the renaming? Can you provide a reproducible example?

library(tidyverse)
(myiris <- select_if(iris,is.numeric) %>% as_tibble())
colnames(myiris)=c("Co","Eleg","Nole","Rate(%)")
myiris
class(myiris)
names(myiris)
colnames(myiris)
view(myiris)

Do you have any issues with this code ?

Your code work, but I couldn't test It with the merge procedure.
I order to solve It, I just unlist and transform to number the column with the problem.

t4_f$rate=as.numeric(unlist(t4_f[,3]/t4_f[,2]))*100
names(t4_f)=c("Co","Eleg","Nole","Rate(%)")
t4_f

I can say I solved It.

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