Hello I am trying to create the below vector but I am getting the error:Error in RD_Exp$TENURE : $ operator is invalid for atomic vectors. can anyone advise how to overcome this? thanks in advance
RD_Exp <-factor(RD_Exp$RACE, levels =c(1,2,3,4,5,6,7),** labelsc("WHITE","BLACK","HISPANIC","ASIAN","INDIAN","HAWIAN","OTHER"))**
It seems that RD_Exp is a vector. What is the result of
str(RD_Exp)
Did you perhaps mean to write something like
RD_Exp$RACE <-factor(RD_Exp$RACE)
at an earlier step so that you would replace the value of the RACE column? If RD_Exp is a data frame and you write
RD_Exp <-factor(RD_Exp$RACE)
the data frame will become a vector.
Thank you so much, you are right I skipped a step, good to go now!