Rename variables after import into R

Hello Everyone,

I usually rename my variable name before I import in R. I tried using the below code but can get it to work. What could I be doing wrong?Ethnicity is my original and I want to rename it to RACE. Any help would be appreciated. Thanks jn advance

RD_Exp <- rename(RD_Exp,Race = Ethnicity)

This code works for me.

DF <- data.frame(Ethnicity = c("A", "B", "C"))
library(dplyr, warn.conflicts = TRUE)
DF <- rename(DF, Race = Ethnicity)

Do you get an error running your code? In what way does your code not work?

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