Hi, I have a new problem. I was trying to use mutate to calculate the percentage of MARRIED respondents (of each year) over years as a new variable. Here is what I have.
gss<-read.csv("newgss.csv") as.numeric(gss$marital) ex2 <- group_by(gss,year) mutate(gss, PercentOfMarried = "MARRIED"/marital)
I've got a result but the outputs were all NA. Can someone please help me? Part of the dataset is attached as a screenshot. Thank you.