Description Usage Arguments Details Value Examples
plot_na
uses dplyr and ggplot2 to return a stacked
barplot showing the counts of NAs for each variable in the
dataset.
1 2 3 |
df |
a data.frame object |
varcut |
a categorical variable to facet the plot. |
title |
a string defining the plot title |
theme |
a string defining theme: "light" (default) or "dark" |
colors |
a character vector of lenght 2, indicating NA and non-NA colors in the plot |
base_font |
a string indicating which font to use (default is Fira Sans Condensed) |
title_font |
a string indicating which font to use (default is Fira Sans Condensed Medium) |
This function is tidyverse based. It transforms the data in a
tibble
, gather
and count
NAs for each variable. Results are ploted in a stacked bar plot
with geom_bar
. Users can define title, colors, and
can plot results grouped by one variable. In this case the plot
will be faceted with facet_wrap
horizontally
displayed.
* mode
options: "light" (default), or "dark"
If varcut
is not passed, then the function plot a simple
stacked barplot showing the counts of NAs for each variable in
the dataset. If is, then the counts are faceted.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # plot_na without varcut
plot_na(sample_data)
# plot_na with varcut (useful for time series data)
plot_na(sample_data, varcut = "year")
# plot_na manipulating other parameters
plot_na(
sample_data,
varcut = "year",
title = "Counts of NAs",
theme = "dark",
colors = c("red", "darkgreen")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.