How to get similar results using dplyr that we can get using sapply
as following:
sapply(mtcars, function(x) sum(is.na(x)))
## mpg cyl disp hp drat wt qsec vs am gear carb
## 0 0 0 0 0 0 0 0 0 0 0`
sapply(mtcars, function(x) sum(x))
## mpg cyl disp hp drat wt qsec vs am gear
## 642.900 198.000 7383.100 4694.000 115.090 102.952 571.160 14.000 13.000 118.000
## carb
## 90.000