Trying to rename recorded observation values for a specific variable: "B36". The data is a household survey and in the specific question/variable B36 asks respondents to record their answer as one of eight numeric values (1,2,3,4,5,6,7,99). I want to correlate these values with the actual name of the agency associated with each number. Obviously I can find alot of stuff online about renaming whole variables, but not so much for observation values.
Here is the whole code I was running - and I can get everything to work except when I plug in the mutate function, which is probably wrong.
HND_plotlevel_Sec_B_df |>
mutate(B36 = recode(B36, 1 = "Cosecha Anterior/Previous Harvest",
2 = "Otro Agricultor/Other Farmer",
3 = "Comprada como Grano/Purchased as Grain",
4 = "Semilla Envasada Comprada/Purchased Packaged Seed",
5 = "Recibido de ONG", 6 = "DICTA/SAG", 7 = "CIAL",
99 = "Otra/Other")),
ggplot(aes(as.factor(B36))) +
geom_bar() +
labs(x="Fuente de Semilla/Seed Source",
y="Productores Individuales/Individual Producers") +
theme(axis.text.x=element_text(angle=45))