How to rename values in a column?

Under the column "sex" numbers are mentioned. I want to rename - "1" to "Male" and "0" to "Female".

[I am trying to make a pie chart of male vs female with percentage annotation. ]

Found it!

heart.df.unique$sex <- factor(heart.df.unique$sex)
levels(heart.df.unique$sex) <- c("Female", "Male")

# 1 is male and 0 is female, if you run only "levels(heart.df.unique$sex)" you'll understand the order of "c("Female", "Male")"

This topic was automatically closed 21 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.