Description Usage Arguments Details Value Examples
Displays a heatmap of missing value frequency across the panel; Inspired by the ExPanDaR package approach as a basis
1 2 3 4 5 6 7 8 | alex_na_plot(
df,
ts_id,
no_factors = FALSE,
binary = FALSE,
colorx = 10,
alphax = 1
)
|
df |
Data frame containing the data. |
ts_id |
A string containing the name of the variable indicating the time dimension. Needs to be coercible into an ordered factor. |
no_factors |
A logical value indicating whether you want to limit the plot to
logical and numerical variables. Defaults to |
binary |
If set to |
colorx |
- color scheme in terms of terrain.colors function from grDevices package (will be loaded and/or installed automatically inside this function) The basic value = 10 (10 means: red color for many missings; yellow color for moderate missing; green color for no or almost no missings) |
alphax |
- alpha of the color transparency function in terms of terrain.colors function from grDevices package; by default it is 1. |
alex_na_plot
This was inspired by a blog post of Rense Nieuwenhuis. And by ExPanDaR package :)
Thanks! You are the best!
This function has a useful add-on to adjust the design of the chart and select colors; by default it is intuitive reg-yellow-green scheme. Datasets with no missing values may be replicated yelow by default - nothing to compare with. You may change the color scheme and design any time.
A ggplot2
plot. ggplot2, data.table and grDevices packages will be loaded, installed and loaded to your system automatically inside this function -
whatever your system needs.
If a package is installed - it will be called; if not - it will be installed and called automatically (user selection for the mirror to download the package may be needed).
1 2 | library(plm); data("Produc", package="plm"); Produc$test = ifelse(Produc$unemp > 5, Produc$unemp, NA) #Adding NAs occasionally to the dataset
alex_na_plot(Produc, ts_id = "year")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.