dt_na_breakdown: Get a breakdown of the NA-status of a column in a data.table
Description
This function takes a (quoted) column to group by, and tabulates
the count of how many of those values are not-NA and NA, and adds
the percent of occurrences. A TRUE in the first output
column means the data is _not_ missing; FALSE corresponds
to missing.
Usage
dt_na_breakdown(DT, acolumn, big.mark = FALSE)
Value
Returns a data.table with three columns:
the not-NA status of the column specified, a count column, and a
percent column (out of 100) to two decimal places
Arguments
DT
The data.table object to operate on
acolumn
a quoted column name
big.mark
If FALSE (default) the "count" column is left
as an integer. If not FALSE, it must be a
character to separate every three digits of the count.
This turns the count column into a string.
Details
The final row is a total count
The quoted group-by variable must be a character or factor