dt_percent_not_na: Return the percentage of non-NA instances in a data.table...

dt_percent_not_naR 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

is.na

Examples


mt <- as.data.table(mtcars)
mt[mpg<16, mpg:=NA]
dt_percent_not_na(mt, "mpg")         # 68.75


libbib documentation built on Nov. 10, 2022, 6:16 p.m.