Hi All, Basically this is my code and I want to get the value of percentage, Category and HRLmean. when I run the code, it looks ok to me but the value of percentage, unrate or unemployed are zero. how do I find all these values? Thank you in advance!
labour_7 <- labour_2%>%
select(LABEL,IMMIG,LFSSTAT,HRLYEARN) %>%
mutate(Category=if_else(IMMIG==1,"immigrant",if_else(IMMIG==2,"immigrant",if_else(IMMIG==3,"native","")))) %>%
filter(HRLYEARN!="NA") %>%
filter(LFSSTAT!="4") %>%
group_by(LABEL) %>%
summarise(HRLmean=mean(HRLYEARN), HRLsd=sd(HRLYEARN),uemployed=sum(LFSSTAT=="3"), sum=sum(LFSSTAT),.groups = 'drop') %>%
mutate(unrate=uemployed/sum, percentage = unrate*100)