dt_percent_not_na | R Documentation |
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
dt_percent_not_na(DT, acolumn)
DT |
A data.table object |
acolumn |
a quoted column name |
Returns percentage of non-NA instances in column
is.na
mt <- as.data.table(mtcars)
mt[mpg<16, mpg:=NA]
dt_percent_not_na(mt, "mpg") # 68.75
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.