Day 07 – little helper count_na
This article is originally published at https://www.statworx.com/de/
We at STATWORX work a lot with R and we often use the same little helper functions within our projects. These functions ease our daily work life by reducing repetitive code parts or by creating overviews of our projects. At first, there was no plan to make a package, but soon I realised, that it will be much easier to share and improve those functions, if they are within a package. Up till the 24th December I will present one function each day from helfRlein
. So, on the 7th day of Christmas my true love gave to me…
What can it do?
This little helper counts missing values within a vector.
x <- c(NA, NA, 1, NaN, 0)
count_na(x)
[1] 3
Internally, there is just a simple sum(is.na(x))
counting the NA
values. If you want the mean instead of the sum you can set mean = TRUE
.
Overview
To see all the other functions you can either check out our GitHub or you can read about them here.
Have a merry advent season!
STATWORX
is a consulting company for data science, statistics, machine learning and artificial intelligence located in Frankfurt, Zurich and Vienna. Sign up for our NEWSLETTER and receive reads and treats from the world of data science and AI.
Der Beitrag Day 07 – little helper count_na erschien zuerst auf STATWORX.
Thanks for visiting r-craft.org
This article is originally published at https://www.statworx.com/de/
Please visit source website for post related comments.