dt_percent_not_na {libbib} | R Documentation |
Return the percentage of non-NA instances in a data.table column
Description
This function takes a data.table and a quoted column name and returns the percentage of the data in the column that is not NA. The percent is out of 100 and contains up to two decimal places
Usage
dt_percent_not_na(DT, acolumn)
Arguments
DT |
A data.table object |
acolumn |
a quoted column name |
Value
Returns percentage of non-NA instances in column
See Also
Examples
mt <- as.data.table(mtcars)
mt[mpg<16, mpg:=NA]
dt_percent_not_na(mt, "mpg") # 68.75
[Package libbib version 1.6.4 Index]