'How to calculate number of rows without NA in a column in tidyverse
I have a DF with people by job, wage and other background statistics. One line is one person. I want to calculate number of people per job, average wage and number of people whith a wage. Some people have a missing wage "NA". I cant seem to calculate number of people with a wage without getting an error.
DF < DF %>%
group_by(Job) %>%
summarise(People = n(),
Average_wage = mean(Wage, na.rm=T),
People_with_a_wage = ???? )
I have tried the following to things:
People_with_a_wage = count(Wage, na.rm=T)
and
People_with_a_wage = n(Wage, na.rm=T)
Both give me an error that says there is a problem in group 1. If i remove the line or change the count to mean it works just fine.
How do i calculate the number of people with a wage?
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
