sort_by_missingness: Sort Variables according to missingness

Description Usage Arguments Value See Also Examples

View source: R/sort_by_missingness.R

Description

Provides a useful way to sort the variables(columns) according to their missingness.

Usage

1
sort_by_missingness(df, sort_by = "counts", descending = FALSE, ...)

Arguments

df

A data.frame object

sort_by

One of counts or percents. This determines whether the results are sorted by counts or percentages.

descending

Logical. Should missing values be sorted in decreasing order ie largest to smallest? Defaults to FALSE.

...

Other arguments to specific functions. See "See also below"

Value

A 'data.frame' object sorted by number/percentage of missing values

See Also

get_na_counts percent_missing

Examples

1
2
3
4
5
sort_by_missingness(airquality, sort_by = "counts")
# sort by percents
sort_by_missingness(airquality, sort_by="percents")
# descending order
sort_by_missingness(airquality, descend = TRUE)

Example output

Welcome to mde. This is mde version 0.2.1.
 Please file issues and feedback at https://www.github.com/Nelson-Gon/mde/issues
Turn this message off using 'suppressPackageStartupMessages(library(mde))'
 Happy Exploration :)
  variable percent
1     Wind       0
2     Temp       0
3    Month       0
4      Day       0
5  Solar.R       7
6    Ozone      37
  variable   percent
1     Wind  0.000000
2     Temp  0.000000
3    Month  0.000000
4      Day  0.000000
5  Solar.R  4.575163
6    Ozone 24.183007
  variable percent
1    Ozone      37
2  Solar.R       7
3     Wind       0
4     Temp       0
5    Month       0
6      Day       0

mde documentation built on Feb. 10, 2022, 5:08 p.m.

Related to sort_by_missingness in mde...