diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 52c2b277..14159b77 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} @@ -29,7 +29,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -47,3 +47,4 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index ed7650c7..a7276e85 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -22,7 +22,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -41,7 +41,7 @@ jobs: - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.4.1 + uses: JamesIves/github-pages-deploy-action@v4.5.0 with: clean: false branch: gh-pages diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5f729fd5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r - -language: r -os: - - linux - - osx -r: - - oldrel - - release - - devel -sudo: false -dist: trusty -cache: packages -warnings_are_errors: true - -r_packages: - - knitr - - rmarkdown - - devtools - - testthat - - covr - -email: - on_success: change - on_failure: change - -env: - global: - - _R_CHECK_FORCE_SUGGESTS_=false - -after_success: - - bash <(curl -s https://codecov.io/bash) - - Rscript -e 'covr::codecov()' - -before_deploy: Rscript -e 'remotes::install_cran("pkgdown")' -deploy: - provider: script - script: Rscript -e 'pkgdown::deploy_site_github()' - skip_cleanup: true - -before_cache: Rscript -e 'remotes::install_cran("pkgdown")' -deploy: - provider: script - script: Rscript -e 'pkgdown::deploy_site_github()' - skip_cleanup: true diff --git a/DESCRIPTION b/DESCRIPTION index d567be0b..5bde86fb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -47,7 +47,6 @@ Suggests: testthat (>= 3.0.0), rpart, rpart.plot, - covr, gridExtra, wakefield, vdiffr, @@ -135,7 +134,7 @@ Collate: 'utils.R' 'where-na.R' URL: https://github.com/njtierney/naniar, - http://naniar.njtierney.com/ + https://naniar.njtierney.com/ BugReports: https://github.com/njtierney/naniar/issues Encoding: UTF-8 Roxygen: list(markdown = TRUE) diff --git a/R/geom-miss-point.R b/R/geom-miss-point.R index 459fa395..9d9a87d1 100644 --- a/R/geom-miss-point.R +++ b/R/geom-miss-point.R @@ -6,11 +6,11 @@ #' the same axis. #' #' @include legend-draw.R -#' @name geom_miss_point -#' @title geom_miss_point -#' @note Warning message if na.rm = T is supplied. +#' @name geom_miss_point +#' @note Warning message if `na.rm = T` is supplied. #' -#' @seealso [gg_miss_case()][gg_miss_case_cumsum()][gg_miss_fct()][gg_miss_span()][gg_miss_var()][gg_miss_var_cumsum()][gg_miss_which()] +#' @seealso [gg_miss_case()] [gg_miss_case_cumsum()] [gg_miss_fct()] +#' [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] #' #' @param mapping Set of aesthetic mappings created by [ggplot2::aes()] #' or [ggplot2::aes_()]. If specified and `inherit.aes = TRUE` @@ -79,17 +79,17 @@ #' facet_wrap(~Month) #'} #' @export - geom_miss_point <- function(mapping = NULL, - data = NULL, - prop_below = 0.1, - jitter = 0.05, - stat = "miss_point", - position = "identity", - colour = ..missing.., - na.rm = FALSE, - show.legend = NA, - inherit.aes = TRUE, - ...) { +geom_miss_point <- function(mapping = NULL, + data = NULL, + prop_below = 0.1, + jitter = 0.05, + stat = "miss_point", + position = "identity", + colour = ..missing.., + na.rm = FALSE, + show.legend = NA, + inherit.aes = TRUE, + ...) { layer( data = data, mapping = mapping, diff --git a/R/gg-miss-case.R b/R/gg-miss-case.R index a0849871..1bfae07d 100644 --- a/R/gg-miss-case.R +++ b/R/gg-miss-case.R @@ -12,7 +12,7 @@ #' #' @return a ggplot object depicting the number of missings in a given case. #' -#' @seealso [geom_miss_point()] [gg_miss_case_cumsum] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] +#' @seealso [geom_miss_point()] [gg_miss_case_cumsum()] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] #' #' @examples #' diff --git a/R/gg-miss-fct.R b/R/gg-miss-fct.R index 452b476e..0e48ac6a 100644 --- a/R/gg-miss-fct.R +++ b/R/gg-miss-fct.R @@ -10,7 +10,7 @@ #' @return ggplot object depicting the % missing of each factor level for #' each variable. #' -#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] +#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum()] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] #' #' @export #' diff --git a/R/gg-miss-span.R b/R/gg-miss-span.R index 69a01b43..dc12343f 100644 --- a/R/gg-miss-span.R +++ b/R/gg-miss-span.R @@ -10,7 +10,7 @@ #' @param span_every integer describing the length of the span to be explored #' @param facet (optional) a single bare variable name, if you want to create a faceted plot. #' -#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum] [gg_miss_fct()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] +#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum()] [gg_miss_fct()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] #' @return ggplot2 showing the number of missings in a span (window, or breaksize) #' @export diff --git a/R/gg-miss-var-cumsum.R b/R/gg-miss-var-cumsum.R index 3e3ffc7f..a516fd0b 100644 --- a/R/gg-miss-var-cumsum.R +++ b/R/gg-miss-var-cumsum.R @@ -8,7 +8,7 @@ #' #' @return a ggplot object showing the cumulative sum of missings over the variables #' -#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_which()] +#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum()] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_which()] #' @export #' diff --git a/R/gg-miss-var.R b/R/gg-miss-var.R index 1dd979c7..c77be821 100644 --- a/R/gg-miss-var.R +++ b/R/gg-miss-var.R @@ -12,7 +12,7 @@ #' #' @return a ggplot object depicting the number of missings in a given column #' -#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] +#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum()] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] #' #' @export #' diff --git a/R/gg-miss-which.R b/R/gg-miss-which.R index 75608aef..07bd9145 100644 --- a/R/gg-miss-which.R +++ b/R/gg-miss-which.R @@ -9,7 +9,7 @@ #' #' @return a ggplot object of which variables contains missing values #' -#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] +#' @seealso [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum()] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] #' #' @export #' diff --git a/R/naniar-package.R b/R/naniar-package.R index b94286c1..49b4c9dd 100644 --- a/R/naniar-package.R +++ b/R/naniar-package.R @@ -1,26 +1,17 @@ -#' naniar -#' +#' @description #' naniar is a package to make it easier to summarise and handle missing values #' in R. It strives to do this in a way that is as consistent with tidyverse #' principles as possible. The work is fully discussed at Tierney & Cook (2023) #' . #' #' @name naniar -#' @docType package -#' @seealso [add_any_miss()] [add_label_missings()] [add_label_shadow()] [add_miss_cluster()] [add_n_miss()] [add_prop_miss()] [add_shadow()] [add_shadow_shift()] [as_shadow()] [bind_shadow()] [cast_shadow()] [cast_shadow_shift()] [cast_shadow_shift_label()] [draw_key_missing_point()] [gather_shadow()] [geom_miss_point()] [gg_miss_case()] [gg_miss_case_cumsum()] [gg_miss_fct()] [gg_miss_span()] [gg_miss_var()] [gg_miss_var_cumsum()] [gg_miss_which()] [label_miss_1d()] [label_miss_2d()] [label_missings()] [pct_miss_case()] [prop_miss_case()] [pct_miss_var()] [prop_miss_var()] [pct_complete_case()] [prop_complete_case()] [pct_complete_var()] [prop_complete_var()] [miss_prop_summary()] [miss_case_summary()] [miss_case_table()] [miss_summary()] [miss_var_prop()] [miss_var_run()] [miss_var_span()] [miss_var_summary()] [miss_var_table()] [n_complete()] [n_complete_row()] [n_miss()] [n_miss_row()] [pct_complete()] [pct_miss()] [prop_complete()] [prop_complete_row()] [prop_miss()] [prop_miss_row()] [replace_to_na()] [replace_with_na()] [replace_with_na_all()] [replace_with_na_at()] [replace_with_na_if()] [shadow_shift()] [stat_miss_point()] [vis_miss()] [where_na()] "_PACKAGE" -#' @import ggplot2 -#' @import rlang -NULL - -#' @importFrom stats median -#' @importFrom visdat vis_miss -#' @export -visdat::vis_miss - ## usethis namespace: start #' @importFrom lifecycle deprecated +#' @import ggplot2 +#' @importFrom stats median +#' @import rlang ## usethis namespace: end NULL diff --git a/R/utils.R b/R/utils.R index ff195851..9805d4af 100644 --- a/R/utils.R +++ b/R/utils.R @@ -10,6 +10,10 @@ rlang::is_na #' @export rlang::are_na +#' @importFrom visdat vis_miss +#' @export +visdat::vis_miss + #' Group By Helper #' #' This is a wrapper to facilitate the `grouped_df` S3 method. diff --git a/README.Rmd b/README.Rmd index d79a0e27..cc6ff546 100644 --- a/README.Rmd +++ b/README.Rmd @@ -12,15 +12,15 @@ knitr::opts_chunk$set( ) ``` -# naniar +# naniar -[![R build status](https://github.com/njtierney/naniar/workflows/R-CMD-check/badge.svg)](https://github.com/njtierney/naniar) +[![R-CMD-check](https://github.com/njtierney/naniar/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/njtierney/naniar/actions/workflows/R-CMD-check.yaml) [![Coverage Status](https://img.shields.io/codecov/c/github/njtierney/naniar/master.svg)](https://app.codecov.io/github/njtierney/naniar?branch=master) [![CRAN Status Badge](https://www.r-pkg.org/badges/version/naniar)](https://cran.r-project.org/package=naniar) [![CRAN Downloads Each Month](https://cranlogs.r-pkg.org/badges/naniar)](https://CRAN.R-project.org/package=naniar) [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) - + `naniar` provides principled, tidy ways to summarise, visualise, and manipulate missing data with minimal deviations from the workflows in ggplot2 and tidy data. It does this by providing: @@ -40,7 +40,7 @@ knitr::opts_chunk$set( - `gg_miss_case()` - `gg_miss_fct()` -For more details on the workflow and theory underpinning naniar, read the vignette [Getting started with naniar](https://naniar.njtierney.com/articles/getting-started-w-naniar.html). +For more details on the workflow and theory underpinning naniar, read the vignette [Getting started with naniar](https://naniar.njtierney.com/articles/naniar.html). For a short primer on the data visualisation available in naniar, read the vignette [Gallery of Missing Data Visualisations](https://naniar.njtierney.com/articles/naniar-visualisation.html). @@ -217,7 +217,7 @@ airquality %>% ``` -You can read more about all of these functions in the vignette ["Getting Started with naniar"](https://naniar.njtierney.com/articles/getting-started-w-naniar.html). +You can read more about all of these functions in the vignette ["Getting Started with naniar"](https://naniar.njtierney.com/articles/naniar.html). # Statistical tests of missingness diff --git a/README.md b/README.md index ec007a67..00fddd5a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ -# naniar +# naniar -[![R build -status](https://github.com/njtierney/naniar/workflows/R-CMD-check/badge.svg)](https://github.com/njtierney/naniar) +[![R-CMD-check](https://github.com/njtierney/naniar/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/njtierney/naniar/actions/workflows/R-CMD-check.yaml) [![Coverage Status](https://img.shields.io/codecov/c/github/njtierney/naniar/master.svg)](https://app.codecov.io/github/njtierney/naniar?branch=master) [![CRAN Status @@ -40,7 +39,7 @@ ggplot2 and tidy data. It does this by providing: For more details on the workflow and theory underpinning naniar, read the vignette [Getting started with -naniar](https://naniar.njtierney.com/articles/getting-started-w-naniar.html). +naniar](https://naniar.njtierney.com/articles/naniar.html). For a short primer on the data visualisation available in naniar, read the vignette [Gallery of Missing Data @@ -370,7 +369,7 @@ airquality %>% You can read more about all of these functions in the vignette [“Getting Started with -naniar”](https://naniar.njtierney.com/articles/getting-started-w-naniar.html). +naniar”](https://naniar.njtierney.com/articles/naniar.html). # Statistical tests of missingness diff --git a/_pkgdown.yml b/_pkgdown.yml index 5ac2e685..d9073324 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: http://naniar.njtierney.com/ +url: https://naniar.njtierney.com/ template: bootstrap: 5 bootswatch: flatly @@ -8,10 +8,10 @@ home: - text: Learn more href: https://github.com/njtierney/naniar authors: - Nick Tierney: + Nicholas Tierney: href: https://njtierney.com/ Di Cook: - href: http://www.dicook.org/ + href: https://www.dicook.org/ Miles McBain: href: https://milesmcbain.xyz/ Colin Fay: @@ -33,6 +33,7 @@ reference: - title: Create special missing values desc: | Create special missing values so that they don't get lost! + See `vignette("special-missing")`. contents: recode_shadow - title: Visualisation desc: | @@ -67,14 +68,16 @@ reference: contents: starts_with("add_") - title: Replacing values with and to NA desc: | - Functions to help replace certain values with NA, which includes scoped variants (_at, _if, _all) that take formulas for flexible approachs + Functions to help replace certain values with NA, which includes scoped variants + (_at, _if, _all) that take formulas for flexible approachs. `vignette("replace-with-na")` contents: - starts_with("replace_with_na") - replace_to_na - replace_na_with - title: Imputation helpers desc: | - Simple imputation methods for exploring visualisation and missingness structure + Simple imputation methods for exploring visualisation and missingness structure. + See `vignette("exploring-imputed-values")` for more details. contents: - starts_with("impute_") - set-prop-n-miss @@ -111,26 +114,30 @@ reference: desc: | Custom ggplot geoms built to extend ggplot for missing values contents: naniar-ggproto + navbar: - left: - - text: Getting Started - href: articles/getting-started-w-naniar.html - - text: Gallery - href: articles/naniar-visualisation.html - - text: Articles - menu: - - text: Replace with NA - href: articles/replace-with-na.html - - text: Special Missings - href: articles/special-missing-values.html - - text: Exploring Imputations - href: articles/exploring-imputed-values.html - - text: Reference - href: reference/index.html - - text: News - releases: - - text: "Version 1.1.0" + structure: + left: [intro, gallery, articles, reference, news] + components: + gallery: + text: Gallery + href: articles/naniar-visualisation.html + articles: + text: Articles + menu: + - text: Replace with NA + href: articles/replace-with-na.html + - text: Special Missings + href: articles/special-missing-values.html + - text: Exploring Imputations + href: articles/exploring-imputed-values.html + +news: + releases: + - text: Version 1.1.0 href: https://www.njtierney.com/post/2024/03/04/naniar-version-1-1-0-prince-caspian/ - - text: News - href: news/index.html + - text: Version 1.0.0 + href: https://www.njtierney.com/post/2023/02/07/naniar-version-1/ +redirects: + - ["articles/getting-started-w-naniar.html", "articles/naniar.html"] diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 8df6b7aa..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,50 +0,0 @@ -# DO NOT CHANGE the "init" and "install" sections below - -# Download script file from GitHub -init: - ps: | - $ErrorActionPreference = "Stop" - Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1" - Import-Module '..\appveyor-tool.ps1' - -install: - ps: Bootstrap - -# Adapt as necessary starting from here - -build_script: - - travis-tool.sh install_deps - #- travis-tool.sh install_github njtierney/visdat - -test_script: - - travis-tool.sh run_tests - -on_failure: - - 7z a failure.zip *.Rcheck\* - - appveyor PushArtifact failure.zip - -on_success: - - Rscript -e 'covr::codecov()' - -environment: - global: - _R_CHECK_FORCE_SUGGESTS_: false - -artifacts: - - path: '*.Rcheck\**\*.log' - name: Logs - - - path: '*.Rcheck\**\*.out' - name: Logs - - - path: '*.Rcheck\**\*.fail' - name: Logs - - - path: '*.Rcheck\**\*.Rout' - name: Logs - - - path: '\*_*.tar.gz' - name: Bits - - - path: '\*_*.zip' - name: Bits diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index cf82c6a8..00000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -naniar.njtierney.com diff --git a/docs/CONDUCT.html b/docs/CONDUCT.html deleted file mode 100644 index 3e29d4e7..00000000 --- a/docs/CONDUCT.html +++ /dev/null @@ -1,89 +0,0 @@ - -Contributor Code of Conduct • naniar - Skip to contents - - -
-
-
- -
- -

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

-

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

-

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

-

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

-

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

-

This Code of Conduct is adapted from the Contributor Covenant (http:contributor-covenant.org), version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/

-
- -
- - -
- - - - - - - diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html deleted file mode 100644 index 3572f027..00000000 --- a/docs/CONTRIBUTING.html +++ /dev/null @@ -1,111 +0,0 @@ - -CONTRIBUTING • naniar - Skip to contents - - -
-
-
- -
- -
-

Please contribute!

-

We love collaboration.

-
-
-

Bugs?

-
-
-

Code contributions

-
  • Fork this repo to your Github account
  • -
  • Clone your version on your account down to your machine from your account, e.g,. git clone https://github.com/<yourgithubusername>/{repo}.git -
  • -
  • Make sure to track progress upstream (i.e., on our version of {repo} at {owner}/{repo}) by doing git remote add upstream https://github.com/{owner}/{repo}.git. Before making changes make sure to pull changes in from upstream by doing either git fetch upstream then merge later or git pull upstream to fetch and merge in one step
  • -
  • Make your changes (bonus points for making changes on a new feature branch)
  • -
  • Push up to your account
  • -
  • Submit a pull request to home base (likely master branch, but check to make sure) at {owner}/{repo} -
  • -
-
-

Prefer to Email?

-

I will be able to better help you if you post an issue but otherwise, you can find my contact details in the DESCRIPTION file of this repo.

-
-
-

Thanks for contributing!

-
-
- -
- - -
- - - - - - - diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html deleted file mode 100644 index 7e622cc8..00000000 --- a/docs/LICENSE-text.html +++ /dev/null @@ -1,83 +0,0 @@ - -License • naniar - Skip to contents - - -
-
-
- -
YEAR: 2016-2018
-COPYRIGHT HOLDER: Nicholas Tierney
-
- -
- - -
- - - - - - - diff --git a/docs/LICENSE.html b/docs/LICENSE.html deleted file mode 100644 index 797cdb57..00000000 --- a/docs/LICENSE.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - -License • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
YEAR: 2016
-COPYRIGHT HOLDER: Nicholas Tierney
-
- -
- -
- - -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/apple-touch-icon-120x120.png b/docs/apple-touch-icon-120x120.png deleted file mode 100644 index eac8435c..00000000 Binary files a/docs/apple-touch-icon-120x120.png and /dev/null differ diff --git a/docs/apple-touch-icon-60x60.png b/docs/apple-touch-icon-60x60.png deleted file mode 100644 index fffc8213..00000000 Binary files a/docs/apple-touch-icon-60x60.png and /dev/null differ diff --git a/docs/apple-touch-icon-76x76.png b/docs/apple-touch-icon-76x76.png deleted file mode 100644 index f31a15ed..00000000 Binary files a/docs/apple-touch-icon-76x76.png and /dev/null differ diff --git a/docs/apple-touch-icon.png b/docs/apple-touch-icon.png deleted file mode 100644 index 7a9bca83..00000000 Binary files a/docs/apple-touch-icon.png and /dev/null differ diff --git a/docs/articles/exploring-imputed-values.html b/docs/articles/exploring-imputed-values.html deleted file mode 100644 index 92e01464..00000000 --- a/docs/articles/exploring-imputed-values.html +++ /dev/null @@ -1,422 +0,0 @@ - - - - - - - - -Exploring Imputed Values • naniar - - - - - - - - - - - - - - - - - Skip to contents - - -
- - - - -
-
- - - -

Imputating missing values is an iterative process. -naniar aims to make it easier to manage imputed values by -providing the nabular data structure to simplify managing -missingness. This vignette provides some useful recipes for imputing and -exploring imputed data.

-

naniar implements a few imputation methods to facilitate -exploration and visualisations, which were not otherwise available: -impute_below, and impute_mean. For single -imputation, the R package simputation works very well with -naniar, and provides the main example given.

-
-

Imputing and tracking missing values -

-
-
-

Using impute_below -

-

impute_below imputes values below the minimum of the -data, with some noise to reduce overplotting. The amount data is imputed -below, and the amount of jitter, can be changed by changing the -arguments prop_below and jitter.

-
-library(dplyr)
-#> 
-#> Attaching package: 'dplyr'
-#> The following objects are masked from 'package:stats':
-#> 
-#>     filter, lag
-#> The following objects are masked from 'package:base':
-#> 
-#>     intersect, setdiff, setequal, union
-library(naniar)
-
-airquality %>%
-  impute_below_at(vars(Ozone)) %>%
-  select(Ozone, Solar.R) %>%
-  head()
-#>       Ozone Solar.R
-#> 1  41.00000     190
-#> 2  36.00000     118
-#> 3  12.00000     149
-#> 4  18.00000     313
-#> 5 -19.72321      NA
-#> 6  28.00000      NA
-
-
-

Using impute_mean -

-

The mean can be imputed using impute_mean, and is useful -to explore structure in missingness, but are not recommended for use in -analysis. Similar to simputation, each impute_ -function returns the data with values imputed.

-

Imputation functions in naniar implement “scoped -variants” for imputation: _all, _at and -_if.

-

This means:

-
    -
  • -_all operates on all columns
  • -
  • -_at operates on specific columns, and
  • -
  • -_if operates on columns that meet some condition (such -as is.numeric or is.character).
  • -
-

If the impute_ functions are used as-is - e.g., -impute_mean, this will work on a single vector, but not a -data.frame.

-

Some examples for impute_mean are now given:

-
-
-impute_mean(oceanbuoys$air_temp_c) %>% head()
-#> [1] 27.15 27.02 27.00 26.93 26.84 26.94
-
-impute_mean_at(oceanbuoys, .vars = vars(air_temp_c)) %>% head()
-#> # A tibble: 6 × 8
-#>    year latitude longitude sea_temp_c air_temp_c humidity wind_ew wind_ns
-#>   <dbl>    <dbl>     <dbl>      <dbl>      <dbl>    <dbl>   <dbl>   <dbl>
-#> 1  1997        0      -110       27.6       27.1     79.6   -6.40    5.40
-#> 2  1997        0      -110       27.5       27.0     75.8   -5.30    5.30
-#> 3  1997        0      -110       27.6       27       76.5   -5.10    4.5 
-#> 4  1997        0      -110       27.6       26.9     76.2   -4.90    2.5 
-#> 5  1997        0      -110       27.6       26.8     76.4   -3.5     4.10
-#> 6  1997        0      -110       27.8       26.9     76.7   -4.40    1.60
-
-impute_mean_if(oceanbuoys, .predicate = is.integer) %>% head()
-#> # A tibble: 6 × 8
-#>    year latitude longitude sea_temp_c air_temp_c humidity wind_ew wind_ns
-#>   <dbl>    <dbl>     <dbl>      <dbl>      <dbl>    <dbl>   <dbl>   <dbl>
-#> 1  1997        0      -110       27.6       27.1     79.6   -6.40    5.40
-#> 2  1997        0      -110       27.5       27.0     75.8   -5.30    5.30
-#> 3  1997        0      -110       27.6       27       76.5   -5.10    4.5 
-#> 4  1997        0      -110       27.6       26.9     76.2   -4.90    2.5 
-#> 5  1997        0      -110       27.6       26.8     76.4   -3.5     4.10
-#> 6  1997        0      -110       27.8       26.9     76.7   -4.40    1.60
-
-impute_mean_all(oceanbuoys) %>% head()
-#> # A tibble: 6 × 8
-#>    year latitude longitude sea_temp_c air_temp_c humidity wind_ew wind_ns
-#>   <dbl>    <dbl>     <dbl>      <dbl>      <dbl>    <dbl>   <dbl>   <dbl>
-#> 1  1997        0      -110       27.6       27.1     79.6   -6.40    5.40
-#> 2  1997        0      -110       27.5       27.0     75.8   -5.30    5.30
-#> 3  1997        0      -110       27.6       27       76.5   -5.10    4.5 
-#> 4  1997        0      -110       27.6       26.9     76.2   -4.90    2.5 
-#> 5  1997        0      -110       27.6       26.8     76.4   -3.5     4.10
-#> 6  1997        0      -110       27.8       26.9     76.7   -4.40    1.60
-

When we impute data like this, we cannot identify where the imputed -values are - we need to track them. We can track the imputed values -using the nabular format of the data.

-
-

Track imputed values using nabular data -

-

We can track the missing values by combining the verbs -bind_shadow, impute_, -add_label_shadow. We can then refer to missing values by -their shadow variable, _NA. The -add_label_shadow function adds an additional column called -any_missing, which tells us if any observation has a -missing value.

-
-
Imputing values using simputation -
-

We can impute the data using the easy-to-use simputation -package, and then track the missingness using bind_shadow -and add_label_shadow:

-
-
-library(simputation)
-#> 
-#> Attaching package: 'simputation'
-#> The following object is masked from 'package:naniar':
-#> 
-#>     impute_median
-ocean_imp <- oceanbuoys %>%
-  bind_shadow() %>%
-  impute_lm(air_temp_c ~ wind_ew + wind_ns) %>%
-  impute_lm(humidity ~  wind_ew + wind_ns) %>%
-  impute_lm(sea_temp_c ~  wind_ew + wind_ns) %>%
-  add_label_shadow()
-

We can then show the previously missing (now imputed!) data in a -scatterplot with ggplot2 by setting the color aesthetic in -ggplot to any_missing:

-
-library(ggplot2)
-ggplot(ocean_imp,
-       aes(x = air_temp_c,
-           y = humidity,
-           color = any_missing)) + 
-  geom_point() +
-  scale_color_brewer(palette = "Dark2") +
-  theme(legend.position = "bottom")
-

-

Or, if you want to look at one variable, you can look at a density -plot of one variable, using fill = any_missing

-
-
-ggplot(ocean_imp,
-       aes(x = air_temp_c,
-           fill = any_missing)) + 
-  geom_density(alpha = 0.3) + 
-  scale_fill_brewer(palette = "Dark2") +
-  theme(legend.position = "bottom")
-
-ggplot(ocean_imp,
-       aes(x = humidity,
-           fill = any_missing)) + 
-  geom_density(alpha = 0.3) + 
-  scale_fill_brewer(palette = "Dark2") +
-  theme(legend.position = "bottom")
-

-

We can also compare imputed values to complete cases by grouping by -any_missing, and summarising.

-
-ocean_imp %>%
-  group_by(any_missing) %>%
-  summarise_at(.vars = vars(air_temp_c),
-               .funs = list(
-                 min = ~ min(.x, na.rm = TRUE), 
-                 mean = ~ mean(.x, na.rm = TRUE), 
-                 median = ~ median(.x, na.rm = TRUE), 
-                 max = ~ max(.x, na.rm = TRUE)
-              ))
-#> # A tibble: 2 × 5
-#>   any_missing   min  mean median   max
-#>   <chr>       <dbl> <dbl>  <dbl> <dbl>
-#> 1 Missing      21.4  23.9   24.4  25.2
-#> 2 Not Missing  22.1  25.3   25.8  28.5
-
-
-
-
-

Improving imputations -

-

One thing that we notice with our imputations are that they aren’t -very good - we can improve upon the imputation by including the -variables year and latitude and longitude:

-
-ocean_imp_yr <- oceanbuoys %>%
-  bind_shadow() %>%
-  impute_lm(air_temp_c ~ wind_ew + wind_ns + year + longitude + latitude) %>%
-  impute_lm(humidity ~  wind_ew + wind_ns + year + longitude + latitude) %>%
-  impute_lm(sea_temp_c ~  wind_ew + wind_ns + year + longitude + latitude) %>%
-  add_label_shadow()
-
-ggplot(ocean_imp_yr,
-       aes(x = air_temp_c,
-           y = humidity,
-           color = any_missing)) + 
-  geom_point() +
-  scale_color_brewer(palette = "Dark2") +
-  theme(legend.position = "bottom")
-

-
-
-

Other imputation approaches -

-

Not all imputation packages return data in tidy

-
-

Hmisc aregImpute -

-

We can explore using a single imputation of -Hmisc::aregImpute(), which allows for multiple imputation -with bootstrapping, additive regression, and predictive mean matching. -We are going to explore predicting mean matching, and single -imputation.

-

-library(Hmisc)
-#> 
-#> Attaching package: 'Hmisc'
-#> The following object is masked from 'package:simputation':
-#> 
-#>     impute
-#> The following objects are masked from 'package:dplyr':
-#> 
-#>     src, summarize
-#> The following objects are masked from 'package:base':
-#> 
-#>     format.pval, units
-
-aq_imp <- aregImpute(~Ozone + Temp + Wind + Solar.R,
-                     n.impute = 1,
-                     type = "pmm",
-                     data = airquality)
-#> Iteration 1 
-Iteration 2 
-Iteration 3 
-Iteration 4 
-
-aq_imp
-#> 
-#> Multiple Imputation using Bootstrap and PMM
-#> 
-#> aregImpute(formula = ~Ozone + Temp + Wind + Solar.R, data = airquality, 
-#>     n.impute = 1, type = "pmm")
-#> 
-#> n: 153   p: 4    Imputations: 1      nk: 3 
-#> 
-#> Number of NAs:
-#>   Ozone    Temp    Wind Solar.R 
-#>      37       0       0       7 
-#> 
-#>         type d.f.
-#> Ozone      s    2
-#> Temp       s    2
-#> Wind       s    2
-#> Solar.R    s    1
-#> 
-#> Transformation of Target Variables Forced to be Linear
-#> 
-#> R-squares for Predicting Non-Missing Values for Each Variable
-#> Using Last Imputations of Predictors
-#>   Ozone Solar.R 
-#>   0.667   0.224
-

We are now going to get our data into nabular form, and -then insert the imputed values:

-
-
-# nabular form!
-aq_nab <- nabular(airquality) %>%  add_label_shadow()
-
-# insert imputed values
-aq_nab$Ozone[is.na(aq_nab$Ozone)] <- aq_imp$imputed$Ozone
-aq_nab$Solar.R[is.na(aq_nab$Solar.R)] <- aq_imp$imputed$Solar.R
-

In the future there will be a more concise way to insert these -imputed values into data, but for the moment the method above is what I -would recommend for single imputation.

-

We can then explore the imputed values like so:

-
-
-ggplot(aq_nab,
-       aes(x = Ozone,
-           y = Solar.R,
-           colour = any_missing)) + 
-  geom_point()
-

-
-
-
-
- - - - -
- - - - - - - diff --git a/docs/articles/exploring-imputed-values_files/figure-html/ggplot-air-temp-humidity-1.png b/docs/articles/exploring-imputed-values_files/figure-html/ggplot-air-temp-humidity-1.png deleted file mode 100644 index 41228857..00000000 Binary files a/docs/articles/exploring-imputed-values_files/figure-html/ggplot-air-temp-humidity-1.png and /dev/null differ diff --git a/docs/articles/exploring-imputed-values_files/figure-html/hmisc-aregimpute-vis-1.png b/docs/articles/exploring-imputed-values_files/figure-html/hmisc-aregimpute-vis-1.png deleted file mode 100644 index 6dac669c..00000000 Binary files a/docs/articles/exploring-imputed-values_files/figure-html/hmisc-aregimpute-vis-1.png and /dev/null differ diff --git a/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-air-temp-humidity-1.png b/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-air-temp-humidity-1.png deleted file mode 100644 index eefffdb7..00000000 Binary files a/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-air-temp-humidity-1.png and /dev/null differ diff --git a/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-density-1.png b/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-density-1.png deleted file mode 100644 index 3f7f46de..00000000 Binary files a/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-density-1.png and /dev/null differ diff --git a/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-density-2.png b/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-density-2.png deleted file mode 100644 index 64a233a8..00000000 Binary files a/docs/articles/exploring-imputed-values_files/figure-html/ocean-imp-density-2.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar.html b/docs/articles/getting-started-w-naniar.html deleted file mode 100644 index e608a95d..00000000 --- a/docs/articles/getting-started-w-naniar.html +++ /dev/null @@ -1,854 +0,0 @@ - - - - - - - - -Getting Started with naniar • naniar - - - - - - - - - - - - - - - - - Skip to contents - - -
- - - - -
-
- - - -
-

Introduction -

-

Missing values are ubiquitous in data and need to be carefully -explored and handled in the initial stages of analysis. In this vignette -we describe the tools in the package naniar for exploring -missing data structures with minimal deviation from the common workflows -of ggplot and tidy data (Wickham, 2014, -Wickham, -2009).

-

Sometimes researchers or analysts will introduce or describe a -mechanism for missingness. For example, they might explain that data -from a weather station might have a malfunction when there are extreme -weather events, and does not record temperature data when gusts speeds -are high. This seems like a nice simple, logical explanation. However, -like all good explanations, this one is simple, but the process to get -there was probably not, and likely involved more time than you would -have liked developing exploratory data analyses and models.

-

So when someone presents a really nice plot and a nice sensible -explanation, the initial thought might be:

-
-

They worked it out themselves so quickly, so easy!

-
-

As if the problem was so easy to solve, they could -accidentally solve it - they couldn’t not solve it.

-

However, I think that if you manage to get that on the first go, that -is more like turning around and throwing a rock into a lake and it -landing in a cup in a boat. Unlikely.

-

With that thought in mind, this vignette aims to work with the -following three questions, using the tools developed in -naniar and another package, visdat. Namely, -how do we:

-
    -
  1. Start looking at missing data?
  2. -
  3. Explore missingness mechanisms?
  4. -
  5. Model missingness?
  6. -
-
-
-

How do we start looking at missing data? -

-

When you start with a dataset, you might do something where you look -at the general summary, using functions such as:

- -

These works really well when you’ve got a small amount of data, but -when you have more data, you are generally limited by how much you can -read.

-

So before you start looking at missing data, you’ll need to look at -the data, but what does that even mean?

-

The package visdat helps you get a handle on this. -visdat provides a visualisation of an entire data frame at -once, and was heavily inspired by csv-fingerprint, -and functions like missmap, from Amelia.

-

There are two main functions in the visdat package:

-
    -
  • -vis_dat, and
  • -
  • vis_miss
  • -
-
-

-vis_dat -

-
-library(visdat)
-vis_dat(airquality)
-

-

vis_dat visualises the whole dataframe at once, and -provides information about the class of the data input into R, as well -as whether the data is missing or not.

-
-

-vis_miss -

-

The function vis_miss provides a summary of whether the -data is missing or not. It also provides the amount of missings in each -columns.

-
-vis_miss(airquality)
-

-

So here, Ozone and Solar.R have the most missing data, with Ozone -having 24.2% missing data and Solar.R have 4.6%. The other variables do -not have any missing data.

-

To read more about the functions available in visdat see -the vignette “Using -visdat”

-
-
-
-
-

Exploring missingness relationships -

-

We can identify key variables that are missing using -vis_miss, but for further exploration, we need to explore -the relationship amongst the variables in this data:

-
    -
  • Ozone,
  • -
  • Solar.R
  • -
  • Wind
  • -
  • Temp
  • -
  • Month
  • -
  • Day
  • -
-

Typically, when exploring this data, you might want to explore the -variables Solar.R and Ozone, and so plot a scatterplot of solar -radiation and ozone, doing something like this:

-
-library(ggplot2)
-ggplot(airquality, 
-       aes(x = Solar.R, 
-           y = Ozone)) + 
-  geom_point()
-
## Warning: Removed 42 rows containing missing values (`geom_point()`).
-

-

The problem with this is that ggplot does not handle missings be -default, and removes the missing values. This makes them hard to -explore. It also presents the strange question of “how do you visualise -something that is not there?”. One approach to visualising missing data -comes from ggobi and manet, where we -replace “NA” values with values 10% lower than the minimum value in that -variable.

-

This process is performed and visualised for you with the -geom_miss_point() ggplot2 geom. Here, we illustrate by -exploring the relationship between Ozone and Solar radiation from the -airquality dataset.

-
-ggplot(airquality, 
-       aes(x = Solar.R, 
-           y = Ozone)) + 
-  geom_point()
-
## Warning: Removed 42 rows containing missing values (`geom_point()`).
-
-library(naniar)
-
-ggplot(airquality, 
-       aes(x = Solar.R, 
-           y = Ozone)) + 
-  geom_miss_point()
-

-

Being a proper ggplot geom, it supports all of the standard features -of ggplot2, such as facets,

-
-ggplot(airquality, 
-       aes(x = Solar.R, 
-           y = Ozone)) + 
-  geom_miss_point() + 
-  facet_wrap(~Month)
-

-

And different themes

-
-ggplot(airquality, 
-       aes(x = Solar.R, 
-           y = Ozone)) + 
-  geom_miss_point() + 
-  facet_wrap(~Month) + 
-  theme_dark()
-

-
-

Visualising missings in variables -

-

Another approach to visualising the missings in a dataset is to use -the gg_miss_var plot:

-
-gg_miss_var(airquality)
-

-

The plots created with the gg_miss family all have a -basic theme, but you can customise them, and add arguments like so:

-
-gg_miss_var(airquality) + theme_bw() 
-

-
-gg_miss_var(airquality) + labs(y = "Look at all the missing ones")
-

-

To add facets in these plots, you can use the facet -argument:

-
-gg_miss_var(airquality, facet = Month)
-

-

There are more visualisations available in naniar (each -starting with gg_miss_) - you can see these in the “Gallery -of Missing Data Visualisations” vignette..

-

It is important to note that for every visualisation of missing data -in naniar, there is an accompanying function to get the -dataframe of the plot out. This is important as the plot should not -return a dataframe - but we also need to make the data available for use -by the user so that it isn’t locked into a plot. You can find these -summary plots below, with miss_var_summary providing the -dataframe that gg_miss_var() is based on.

-
-
-
-

Replacing existing values with NA -

-

When you are dealing with missing values, you might want to replace -values with a missing values (NA). This is useful in cases when you know -the origin of the data and can be certain which values should be -missing. For example, you might know that all values of “N/A”, “N A”, -and “Not Available”, or -99, or -1 are supposed to be missing.

-

naniar provides functions to specifically work on this -type of problem using the function replace_with_na. This -function is the compliment to tidyr::replace_na, which -replaces an NA value with a specified value, whereas -naniar::replace_with_na replaces a value with an NA:

- -

You can read more about this in the vignette “Replacing -values with NA”

-
-
-

Tidy Missing Data: The Shadow Matrix -

-

Representing missing data structure in a tidy format is achieved -using the shadow matrix, introduced in Swayne -and Buja. The shadow matrix is the same dimension as the data, and -consists of binary indicators of missingness of data values, where -missing is represented as “NA”, and not missing is represented as “!NA”. -Although these may be represented as 1 and 0, respectively. This -representation can be seen in the figure below, adding the suffix “_NA” -to the variables. This structure can also be extended to allow for -additional factor levels to be created. For example 0 indicates data -presence, 1 indicates missing values, 2 indicates imputed value, and 3 -might indicate a particular type or class of missingness, where reasons -for missingness might be known or inferred. The data matrix can also be -augmented to include the shadow matrix, which facilitates visualisation -of univariate and bivariate missing data visualisations. Another format -is to display it in long form, which facilitates heatmap style -visualisations. This approach can be very helpful for giving an overview -of which variables contain the most missingness. Methods can also be -applied to rearrange rows and columns to find clusters, and identify -other interesting features of the data that may have previously been -hidden or unclear.

-

-

Illustration of data structures for facilitating -visualisation of missings and not missings

-

The shadow functions provide a way to keep track of -missing values. The as_shadow function creates a dataframe -with the same set of columns, but with the column names added a suffix -_NA

-
-as_shadow(airquality)
-
## # A tibble: 153 × 6
-##    Ozone_NA Solar.R_NA Wind_NA Temp_NA Month_NA Day_NA
-##    <fct>    <fct>      <fct>   <fct>   <fct>    <fct> 
-##  1 !NA      !NA        !NA     !NA     !NA      !NA   
-##  2 !NA      !NA        !NA     !NA     !NA      !NA   
-##  3 !NA      !NA        !NA     !NA     !NA      !NA   
-##  4 !NA      !NA        !NA     !NA     !NA      !NA   
-##  5 NA       NA         !NA     !NA     !NA      !NA   
-##  6 !NA      NA         !NA     !NA     !NA      !NA   
-##  7 !NA      !NA        !NA     !NA     !NA      !NA   
-##  8 !NA      !NA        !NA     !NA     !NA      !NA   
-##  9 !NA      !NA        !NA     !NA     !NA      !NA   
-## 10 NA       !NA        !NA     !NA     !NA      !NA   
-## # ℹ 143 more rows
-

bind_shadow attaches a shadow to the current dataframe, -a format we call “nabular”, a portmanteau of NA a -tabular. You can also use nabular to do the -same thing:

-
-aq_shadow <- bind_shadow(airquality)
-aq_nab <- nabular(airquality)
-
-library(dplyr)
-
## 
-## Attaching package: 'dplyr'
-
## The following objects are masked from 'package:stats':
-## 
-##     filter, lag
-
## The following objects are masked from 'package:base':
-## 
-##     intersect, setdiff, setequal, union
-
-glimpse(aq_shadow)
-
## Rows: 153
-## Columns: 12
-## $ Ozone      <int> 41, 36, 12, 18, NA, 28, 23, 19, 8, NA, 7, 16, 11, 14, 18, 1…
-## $ Solar.R    <int> 190, 118, 149, 313, NA, NA, 299, 99, 19, 194, NA, 256, 290,…
-## $ Wind       <dbl> 7.4, 8.0, 12.6, 11.5, 14.3, 14.9, 8.6, 13.8, 20.1, 8.6, 6.9…
-## $ Temp       <int> 67, 72, 74, 62, 56, 66, 65, 59, 61, 69, 74, 69, 66, 68, 58,…
-## $ Month      <int> 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,…
-## $ Day        <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, …
-## $ Ozone_NA   <fct> !NA, !NA, !NA, !NA, NA, !NA, !NA, !NA, !NA, NA, !NA, !NA, !…
-## $ Solar.R_NA <fct> !NA, !NA, !NA, !NA, NA, NA, !NA, !NA, !NA, !NA, NA, !NA, !N…
-## $ Wind_NA    <fct> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA,…
-## $ Temp_NA    <fct> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA,…
-## $ Month_NA   <fct> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA,…
-## $ Day_NA     <fct> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA,…
-
-glimpse(aq_nab)
-
## Rows: 153
-## Columns: 12
-## $ Ozone      <int> 41, 36, 12, 18, NA, 28, 23, 19, 8, NA, 7, 16, 11, 14, 18, 1…
-## $ Solar.R    <int> 190, 118, 149, 313, NA, NA, 299, 99, 19, 194, NA, 256, 290,…
-## $ Wind       <dbl> 7.4, 8.0, 12.6, 11.5, 14.3, 14.9, 8.6, 13.8, 20.1, 8.6, 6.9…
-## $ Temp       <int> 67, 72, 74, 62, 56, 66, 65, 59, 61, 69, 74, 69, 66, 68, 58,…
-## $ Month      <int> 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,…
-## $ Day        <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, …
-## $ Ozone_NA   <fct> !NA, !NA, !NA, !NA, NA, !NA, !NA, !NA, !NA, NA, !NA, !NA, !…
-## $ Solar.R_NA <fct> !NA, !NA, !NA, !NA, NA, NA, !NA, !NA, !NA, !NA, NA, !NA, !N…
-## $ Wind_NA    <fct> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA,…
-## $ Temp_NA    <fct> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA,…
-## $ Month_NA   <fct> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA,…
-## $ Day_NA     <fct> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA,…
-
-all.equal(aq_shadow, aq_nab)
-
## [1] TRUE
-

Doing this provides a consistent syntax for referring to variables -with missing values.

-

Nabular data provides a useful pattern to explore missing -values, grouping by the missing/complete of one variable and looking at -the mean and other summary values. Below we show the mean, sd, variance, -and min and max values of Solar.R for when Ozone is present, and when it -is missing.

-
-airquality %>%
-  bind_shadow() %>%
-  group_by(Ozone_NA) %>%
-  summarise_at(.vars = "Solar.R",
-               .funs = c("mean", "sd", "var", "min", "max"),
-               na.rm = TRUE)
-
## # A tibble: 2 × 6
-##   Ozone_NA  mean    sd   var   min   max
-##   <fct>    <dbl> <dbl> <dbl> <int> <int>
-## 1 !NA       185.  91.2 8309.     7   334
-## 2 NA        190.  87.7 7690.    31   332
-

Below, we can plot the distribution of Temperature, plotting for -values of temperature when Ozone is missing, and when it is not -missing.

-
-ggplot(aq_shadow,
-       aes(x = Temp,
-           colour = Ozone_NA)) + 
-  geom_density()
-

-

We can also explore the value of air temperature and humidity based -on missingness of each.

-
-# what if we explore the value of air temperature and humidity based on
-# the missingness of each
-  oceanbuoys %>%
-    bind_shadow() %>%
-    ggplot(aes(x = air_temp_c,
-               fill = humidity_NA)) +
-        geom_histogram()
-
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
## Warning: Removed 81 rows containing non-finite values (`stat_bin()`).
-

-
-  oceanbuoys %>%
-    bind_shadow() %>%
-    ggplot(aes(x = humidity,
-               fill = air_temp_c_NA)) +
-        geom_histogram()
-
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
## Warning: Removed 93 rows containing non-finite values (`stat_bin()`).
-

-

Binding the shadow here also has great benefits when combined with -imputation.

-
-
-

Visualising imputed values -

-

With the easy-to-use simputation -package, we impute values for Ozone, then visualise the data:

- -
## 
-## Attaching package: 'simputation'
-
## The following object is masked from 'package:naniar':
-## 
-##     impute_median
-
-library(dplyr)
-
-airquality %>%
-  impute_lm(Ozone ~ Temp + Wind) %>%
-  ggplot(aes(x = Temp,
-             y = Ozone)) + 
-  geom_point()
-

-

Note that we no longer get any errors regarding missing observations -- because they are all imputed! But this comes at a cost: we also no -longer have information about where the imputations are - they are now -sort of invisible.

-

Using the shadow matrix to keep track of where the missings are, you -can actually keep track of the imputations, by colouring by what was -previously missing in Ozone.

-
-aq_shadow %>%
-  as.data.frame() %>% 
-  impute_lm(Ozone ~ Temp + Wind) %>%
-  ggplot(aes(x = Temp,
-             y = Ozone,
-             colour = Ozone_NA)) + 
-  geom_point()
-

-
-

Numerical summaries of missing values -

-

naniar also provide numerical summaries for missing -data. Two convenient counters of complete values and missings are -n_miss() and n_complete(). These work on both -dataframes and vectors, similar to dplyr::n_distinct()

-
-dplyr::n_distinct(airquality)
-
## [1] 153
-
-dplyr::n_distinct(airquality$Ozone)
-
## [1] 68
-
-n_miss(airquality)
-
## [1] 44
-
-n_miss(airquality$Ozone)
-
## [1] 37
-
-n_complete(airquality)
-
## [1] 874
-
-n_complete(airquality$Ozone)
-
## [1] 116
-

The syntax for the other numerical sumamries in naniar -are miss_, and then case, or var -to refer to cases or variables. There are then summary, -table, run, span, and -cumsum options to explore missing data.

-

prop_miss_case and pct_miss_case return -numeric value describing the proportion or percent of missing values in -the dataframe.

-
-prop_miss_case(airquality)
-
## [1] 0.2745098
-
-pct_miss_case(airquality)
-
## [1] 27.45098
-

miss_case_summary() returns a numeric value that -describes the number of missings in a given case (aka row), the percent -of missings in that row.

-
-miss_case_summary(airquality)
-
## # A tibble: 153 × 3
-##     case n_miss pct_miss
-##    <int>  <int>    <dbl>
-##  1     5      2     33.3
-##  2    27      2     33.3
-##  3     6      1     16.7
-##  4    10      1     16.7
-##  5    11      1     16.7
-##  6    25      1     16.7
-##  7    26      1     16.7
-##  8    32      1     16.7
-##  9    33      1     16.7
-## 10    34      1     16.7
-## # ℹ 143 more rows
-

miss_case_table() tabulates the number of missing values -in a case / row. Below, this shows the number of missings in a case:

-
    -
  • There are 111 cases with 0 missings, which comprises about 72% of -the data.
  • -
  • There are then 40 cases with 1 missing, these make up 26% of the -data.
  • -
  • There are then 2 cases with 2 missing - these make up 1% of the -data.
  • -
-
-miss_case_table(airquality)
-
## # A tibble: 3 × 3
-##   n_miss_in_case n_cases pct_cases
-##            <int>   <int>     <dbl>
-## 1              0     111     72.5 
-## 2              1      40     26.1 
-## 3              2       2      1.31
-

Similar to pct_miss_case(), -prop_miss_case(), pct_miss_var() and -prop_miss_var() returns the percent and proportion of -variables that contain a missing value.

-
-prop_miss_var(airquality)
-
## [1] 0.3333333
-
-pct_miss_var(airquality)
-
## [1] 33.33333
-

miss_var_summary() then returns the number of missing -values in a variable, and the percent missing in that variable.

-
-miss_var_summary(airquality)
-
## # A tibble: 6 × 3
-##   variable n_miss pct_miss
-##   <chr>     <int>    <dbl>
-## 1 Ozone        37    24.2 
-## 2 Solar.R       7     4.58
-## 3 Wind          0     0   
-## 4 Temp          0     0   
-## 5 Month         0     0   
-## 6 Day           0     0
-

Finally, miss_var_table(). This describes the number of -missings in a variable.

-
    -
  • There are 4 variables with 0 missings, comprising 66.67% of -variables in the dataset.
  • -
  • There is 1 variable with 7 missings
  • -
  • There is 1 variable with 37 missings
  • -
-
-miss_var_table(airquality)
-
## # A tibble: 3 × 3
-##   n_miss_in_var n_vars pct_vars
-##           <int>  <int>    <dbl>
-## 1             0      4     66.7
-## 2             7      1     16.7
-## 3            37      1     16.7
-

There are also summary functions for exploring missings that occur -over a particular span or period of the dataset, or the number of -missings in a single run:

- -

miss_var_run() can be particularly useful in time series -data, as it allows you to provide summaries for the number of missings -or complete values in a single run. The function -miss_var_run() provides a data.frame of the run length of -missings and complete values. To explore this function we will use the -built-in dataset, pedestrian, which contains hourly counts -of pedestrians from four locations around Melbourne, Australia, from -2016.

-

To use miss_var_run(), you specify the variable that you -want to explore the runs of missingness for, in this case, -hourly_counts:

-
-miss_var_run(pedestrian,
-             hourly_counts)
-
## # A tibble: 35 × 2
-##    run_length is_na   
-##         <int> <chr>   
-##  1       6628 complete
-##  2          1 missing 
-##  3       5250 complete
-##  4        624 missing 
-##  5       3652 complete
-##  6          1 missing 
-##  7       1290 complete
-##  8        744 missing 
-##  9       7420 complete
-## 10          1 missing 
-## # ℹ 25 more rows
-

miss_var_span() is used to determine the number of -missings over a specified repeating span of rows in variable of a -dataframe. Similar to miss_var_run(), you specify the -variable that you wish to explore, you then also specify the size of the -span with the span_every argument.

-
-miss_var_span(pedestrian,
-              hourly_counts,
-              span_every = 100)
-
## # A tibble: 377 × 6
-##    span_counter n_miss n_complete prop_miss prop_complete n_in_span
-##           <int>  <int>      <int>     <dbl>         <dbl>     <int>
-##  1            1      0        100         0             1       100
-##  2            2      0        100         0             1       100
-##  3            3      0        100         0             1       100
-##  4            4      0        100         0             1       100
-##  5            5      0        100         0             1       100
-##  6            6      0        100         0             1       100
-##  7            7      0        100         0             1       100
-##  8            8      0        100         0             1       100
-##  9            9      0        100         0             1       100
-## 10           10      0        100         0             1       100
-## # ℹ 367 more rows
-
-
-
-

Using group_by with naniar -

-

Every miss_* summary function that returns a dataframe -can be used with dplyr group_by(). For example, if you -would like to look at the number of missing values for all variables of -pedestrian data.

-
-pedestrian %>% miss_var_summary()
-
## # A tibble: 9 × 3
-##   variable      n_miss pct_miss
-##   <chr>          <int>    <dbl>
-## 1 hourly_counts   2548     6.76
-## 2 date_time          0     0   
-## 3 year               0     0   
-## 4 month              0     0   
-## 5 month_day          0     0   
-## 6 week_day           0     0   
-## 7 hour               0     0   
-## 8 sensor_id          0     0   
-## 9 sensor_name        0     0
-

We see that this is in hourly_counts. We can then -explore this by month, and filder by the variable being -hourly_counts, since it is the only one with missing -values.

-
-pedestrian %>%
- group_by(month) %>%
- miss_var_summary() %>%
- filter(variable == "hourly_counts")
-
## # A tibble: 12 × 4
-## # Groups:   month [12]
-##    month     variable      n_miss pct_miss
-##    <ord>     <chr>          <int>    <dbl>
-##  1 January   hourly_counts      0     0   
-##  2 February  hourly_counts      0     0   
-##  3 March     hourly_counts      0     0   
-##  4 April     hourly_counts    552    19.2 
-##  5 May       hourly_counts     72     2.42
-##  6 June      hourly_counts      0     0   
-##  7 July      hourly_counts      0     0   
-##  8 August    hourly_counts    408    13.7 
-##  9 September hourly_counts      0     0   
-## 10 October   hourly_counts    412     7.44
-## 11 November  hourly_counts    888    30.8 
-## 12 December  hourly_counts    216     7.26
-
-
-

Modelling missingness -

-

The final question we proposed in this vignette was:

-
    -
  1. Can we model missingness?
  2. -
-

Sometimes it can be impractical to explore all of the variables that -have missing data. One approach, however, is to model missing data using -methods from Tierney et el. (2015).

-

Here, the approach is to predict the proportion of missingness in a -given case, using all variables. There is a little helper function to -add a column with the proportion of cases or rows missing - -add_prop_miss(). This created a column named “prop_miss”, -which is the proportion of missing values in that row.

-
-airquality %>%
-  add_prop_miss() %>%
-  head()
-
##   Ozone Solar.R Wind Temp Month Day prop_miss_all
-## 1    41     190  7.4   67     5   1     0.0000000
-## 2    36     118  8.0   72     5   2     0.0000000
-## 3    12     149 12.6   74     5   3     0.0000000
-## 4    18     313 11.5   62     5   4     0.0000000
-## 5    NA      NA 14.3   56     5   5     0.3333333
-## 6    28      NA 14.9   66     5   6     0.1666667
-

We can then use a model like decision trees to predict which -variables and their values are important for predicting the proportion -of missingness:

-
-library(rpart)
-library(rpart.plot)
-
-airquality %>%
-  add_prop_miss() %>%
-  rpart(prop_miss_all ~ ., data = .) %>%
-  prp(type = 4, extra = 101, prefix = "Prop. Miss = ")
-
## Warning: Cannot retrieve the data used to build the model (so cannot determine roundint and is.binary for the variables).
-## To silence this warning:
-##     Call prp with roundint=FALSE,
-##     or rebuild the rpart model with model=TRUE.
-

-

Here we can see that this produces quite a complex tree - this can be -pruned back and the depth of the decision tree controlled.

-
-
-

Summary -

-

The tools in naniar help us identify where missingness -is, while maintaining a tidy workflow. We care about these mechanisms or -these patterns because they can help us understand potential mechanisms, -such as equipment failures, and then identify possible solutions based -upon this evidence.

-
-
-

Future development -

-
    -
  • Make naniar work with big data tools like -sparklyr, and sparklingwater.
  • -
  • Further develop methods for handling and visualising imputations, -and multiple imputation. Other plans to extend the -geom_miss_ family to include:
  • -
  • Categorical variables
  • -
  • Bivariate plots: scatterplots, density overlays
  • -
  • Provide tools for assessing goodness of fit for classical approaches -of MCAR, MAR, and MNAR (graphical inference from nullabor -package)
  • -
-
-
-

Thank you -

-

Firstly, thanks to Di Cook for giving the initial inspiration for the -package and laying down the rich theory and literature that the work in -naniar is built upon. Naming credit (once again!) goes to -Miles McBain. Among various other things, Miles also worked out how to -overload the missing data and make it work as a geom. Thanks also to -Colin Fay for helping me understand tidy evaluation and for features -such as replace_with_na, miss_*_cumsum, and -more.

-
-
-

References -

- -
-
-
- - - - -
- - - - - - - diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/example-geom-point-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/example-geom-point-1.png deleted file mode 100644 index d1db8af3..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/example-geom-point-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/geom-miss-point-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/geom-miss-point-1.png deleted file mode 100644 index 58afb76a..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/geom-miss-point-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/geom-miss-point-2.png b/docs/articles/getting-started-w-naniar_files/figure-html/geom-miss-point-2.png deleted file mode 100644 index 2b7d8d88..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/geom-miss-point-2.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-1.png deleted file mode 100644 index b43c0051..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-2.png b/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-2.png deleted file mode 100644 index 62b10815..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-2.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-facet-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-facet-1.png deleted file mode 100644 index 69195201..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-facet-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-theme-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-theme-1.png deleted file mode 100644 index 3434c986..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-theme-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-theme-2.png b/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-theme-2.png deleted file mode 100644 index 3839b006..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/gg-miss-var-theme-2.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/ggmissing-facet-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/ggmissing-facet-1.png deleted file mode 100644 index 7b87966c..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/ggmissing-facet-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/ggmissing-theme-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/ggmissing-theme-1.png deleted file mode 100644 index c345e583..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/ggmissing-theme-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/rpart-miss-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/rpart-miss-1.png deleted file mode 100644 index b61ae4fd..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/rpart-miss-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/shadow-plot-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/shadow-plot-1.png deleted file mode 100644 index 8f0630b8..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/shadow-plot-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/simpute-invisible-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/simpute-invisible-1.png deleted file mode 100644 index 958b35fd..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/simpute-invisible-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/simpute-visible-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/simpute-visible-1.png deleted file mode 100644 index 1bfb310f..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/simpute-visible-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-1-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-1-1.png deleted file mode 100644 index 830549f3..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-1-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-2-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-2-1.png deleted file mode 100644 index 39874d4b..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-2-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-2-2.png b/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-2-2.png deleted file mode 100644 index a49a40b9..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-2-2.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-3-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-3-1.png deleted file mode 100644 index 7b27310d..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-3-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-4-1.png deleted file mode 100644 index 4b04c3a4..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-4-2.png b/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-4-2.png deleted file mode 100644 index e7d23c05..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-4-2.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-8-1.png deleted file mode 100644 index 62ee5bdc..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-8-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-9-1.png deleted file mode 100644 index a8ca5293..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/unnamed-chunk-9-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/vis-dat-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/vis-dat-1.png deleted file mode 100644 index aaac1f38..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/vis-dat-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-naniar_files/figure-html/vis-miss-cluster-vanilla-1.png b/docs/articles/getting-started-w-naniar_files/figure-html/vis-miss-cluster-vanilla-1.png deleted file mode 100644 index 15a48d43..00000000 Binary files a/docs/articles/getting-started-w-naniar_files/figure-html/vis-miss-cluster-vanilla-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia.html b/docs/articles/getting-started-w-narnia.html deleted file mode 100644 index 4dd99730..00000000 --- a/docs/articles/getting-started-w-narnia.html +++ /dev/null @@ -1,530 +0,0 @@ - - - - - - - -Getting Started with Narnia • naniar - - - - - - -
-
- - - -
-
- - - - -
-
-

-Introduction

-

Missing values are ubiquitous in data and need to be carefully explored and handled in the initial stages of analysis. In this vignette we describe the tools in the package narnia for exploring missing data structures with minimal deviation from the common workflows of ggplot and tidy data [@Wickham2014; @Wickham2009].

-

Sometimes researchers or analysts will introduce or describe a mechanism for missingness. For example, they might explain that data from a weather station might has a malfunction when there are extreme weather events, and does not record temperature data when gusts speeds are high. This seems like a nice simple, logical explanation. However, like all good explanations, this one is simple, but the process to get there, probably was not, and likely involved more time than you would have liked developing exploratory data analyses and models.

-

So when someone presents a really obvious plot like this, with a nice sensible explanation, the initial thought might be:

-
-

They worked it out themselves so quickly, so easy!

-
-

As if they somehow accidentally solved the problem, it was so easy. They couldn’t not solve it. However, I think that if you manage to get that on the first go, that is more like turning around and throwing a rock into a lake and it landing in a cup in a boat. Unlikely.

-

With that thought in mind, this vignette aims to work with the following three questions, using the tools developed in narnia and another package, visdat. Namely, how do we:

-
    -
  1. Start looking at missing data?
  2. -
  3. Explore missingness mechanisms?
  4. -
  5. Model missingness?
  6. -
-
-
-

-How do we start looking at missing data?

-

When you start with a dataset, you might do something where you look at the general summary, using functions such as:

- -

These works really well when you’ve got a small amount of data, but when you have more data, you are generally limited by how much you can read.

-

So before you start looking at missing data, you’ll need to look at the data, but what does that even mean?

-

The package visdat helps you get a handle on this. visdat provides a visualisation of an entire data frame at once, and was heavily inspired by csv-fingerprint, and the missingness map functions from packages like Amelia::missmap.

-

There are two main functions in the visdat package:

-
    -
  • -vis_dat, and
  • -
  • vis_miss
  • -
-
-

-vis_dat -

-
library(visdat)
-vis_dat(airquality)
-

-

These visualise the whole dataframe at once, and provide some useful information about whether the data is missing or not. It also provides information about the class of the data input into R.

-

The function vis_miss provides a summary of whether the data is all present, and also provides small summaries in each column as to the amount of missings in each of the columns.

-
-

-vis_miss -

-
vis_miss(airquality)
-

-

To read more about the functions available in visdat see the vignette “Using visdat”

-
-
-
-
-

-Exploring missingness relationships

-

We can identify key variables that are missing

-

For further exploration, we need to explore the relationship amongst the variables in this data:

-
    -
  • Ozone,
  • -
  • Solar.R
  • -
  • Wind
  • -
  • Temp
  • -
  • Month
  • -
  • Day
  • -
-

This process of visualising the data as a heatmap allows you identify what is missing and where. For here though, are interested in exploring these missingness relationships.

-

Typically, when exploring this data, you might want to explore the variables Solar.R and Ozone, and do something like this:

-
library(ggplot2)
-ggplot(airquality,
-       aes(x = Solar.R,
-           y = Ozone)) + 
-  geom_point()
-
## Warning: Removed 42 rows containing missing values (geom_point).
-

-

The problem with this is that ggplot does not handle missings be default, and removes the missing values. This makes them hard to explore.

-

Visualising missing data might sound a little strange - how do you visualise something that is not there? One approach to visualising missing data comes from ggobi and manet, where we replace “NA” values with values 10% lower than the minimum value in that variable. This is provided with the geom_miss_point() ggplot2 geom, which we can illustrate by exploring the relationship between Ozone and Solar radiation from the airquality dataset.

-
ggplot(airquality,
-       aes(x = Solar.R,
-           y = Ozone)) + 
-  geom_point()
-
## Warning: Removed 42 rows containing missing values (geom_point).
-
library(narnia)
-
-ggplot(airquality,
-       aes(x = Solar.R,
-           y = Ozone)) + 
-  geom_miss_point()
-

-

Facets!

-
ggplot(airquality,
-       aes(x = Solar.R,
-           y = Ozone)) + 
-  geom_miss_point() + 
-  facet_wrap(~Month)
-

-

Themes!

-
ggplot(airquality,
-       aes(x = Solar.R,
-           y = Ozone)) + 
-  geom_miss_point() + 
-  facet_wrap(~Month) + 
-  theme_dark()
-

-
-

-Visualising missings in variables

-

Another approach to visualising the missings in a dataset is to use the gg_miss_var plot:

-
gg_miss_var(airquality)
-

-

This creates a ggplot2 object with the number of missing values for each variable, ordered from most missing to least missing. Under the hood, this is powered using miss_var_summary(), described later.

-

The plots created with the gg_miss family all have a basic theme, but you can customise them, just like usual ggplot objects. If you call any ggplot customisation functions with a gg_miss object, the default args will be overridden.

-
gg_miss_var(airquality) + theme_bw() 
-

-
gg_miss_var(airquality) + labs(y = "Look at all the missing ones")
-

-
-
-
-

-shadow matrix: A tidy way of representing missing values

-

Representing missing data structure is achieved using the shadow matrix, introduced in Swayne and Buja. The shadow matrix is the same dimension as the data, and consists of binary indicators of missingness of data values, where missing is represented as “NA”, and not missing is represented as “!NA”. Although these may be represented as 1 and 0, respectively. This representation can be seen in the figure below, adding the suffix “_NA" to the variables. This structure can also be extended to allow for additional factor levels to be created. For example 0 indicates data presence, 1 indicates missing values, 2 indicates imputed value, and 3 might indicate a particular type or class of missingness, where reasons for missingness might be known or inferred. The data matrix can also be augmented to include the shadow matrix, which facilitates visualisation of univariate and bivariate missing data visualisations. Another format is to display it in long form, which facilitates heatmap style visualisations. This approach can be very helpful for giving an overview of which variables contain the most missingness. Methods can also be applied to rearrange rows and columns to find clusters, and identify other interesting features of the data that may have previously been hidden or unclear.

-

-

Illustration of data structures for facilitating visualisation of missings and not missings

-

The shadow functions provide a way to keep track of missing values. The as_shadow function creates a dataframe with the same set of columns, but with the column names added a suffix _NA

-
as_shadow(airquality)
-
## # A tibble: 153 x 6
-##    Ozone_NA Solar.R_NA Wind_NA Temp_NA Month_NA Day_NA
-##      <fctr>     <fctr>  <fctr>  <fctr>   <fctr> <fctr>
-##  1      !NA        !NA     !NA     !NA      !NA    !NA
-##  2      !NA        !NA     !NA     !NA      !NA    !NA
-##  3      !NA        !NA     !NA     !NA      !NA    !NA
-##  4      !NA        !NA     !NA     !NA      !NA    !NA
-##  5       NA         NA     !NA     !NA      !NA    !NA
-##  6      !NA         NA     !NA     !NA      !NA    !NA
-##  7      !NA        !NA     !NA     !NA      !NA    !NA
-##  8      !NA        !NA     !NA     !NA      !NA    !NA
-##  9      !NA        !NA     !NA     !NA      !NA    !NA
-## 10       NA        !NA     !NA     !NA      !NA    !NA
-## # ... with 143 more rows
-

The bind_shadow argument attaches a shadow to the current dataframe

-
aq_shadow <- bind_shadow(airquality)
-
-library(dplyr)
-
##
-## Attaching package: 'dplyr'
-
## The following objects are masked from 'package:stats':
-##
-##     filter, lag
-
## The following objects are masked from 'package:base':
-##
-##     intersect, setdiff, setequal, union
-
glimpse(aq_shadow)
-
## Observations: 153
-## Variables: 12
-## $ Ozone      <int> 41, 36, 12, 18, NA, 28, 23, 19, 8, NA, 7, 16, 11, 1...
-## $ Solar.R    <int> 190, 118, 149, 313, NA, NA, 299, 99, 19, 194, NA, 2...
-## $ Wind       <dbl> 7.4, 8.0, 12.6, 11.5, 14.3, 14.9, 8.6, 13.8, 20.1, ...
-## $ Temp       <int> 67, 72, 74, 62, 56, 66, 65, 59, 61, 69, 74, 69, 66,...
-## $ Month      <int> 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, ...
-## $ Day        <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ...
-## $ Ozone_NA   <fctr> !NA, !NA, !NA, !NA, NA, !NA, !NA, !NA, !NA, NA, !N...
-## $ Solar.R_NA <fctr> !NA, !NA, !NA, !NA, NA, NA, !NA, !NA, !NA, !NA, NA...
-## $ Wind_NA    <fctr> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, ...
-## $ Temp_NA    <fctr> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, ...
-## $ Month_NA   <fctr> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, ...
-## $ Day_NA     <fctr> !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, !NA, ...
-

Doing this provides a consistent syntax for referring to variables with missing values.

-

bind_shadow() also provides a useful pattern to explore missing values by grouping by the missing/complete of one variable and looking at the mean and other summary values. Below we show the mean, sd, variance, and min and max values of Solar.R for when Ozone is present, and when it is missing.

-
airquality %>%
-  bind_shadow() %>%
-  group_by(Ozone_NA) %>%
-  summarise_at(.vars = "Solar.R",
-               .funs = c("mean", "sd", "var", "min", "max"),
-               na.rm = TRUE)
-
## # A tibble: 2 x 6
-##   Ozone_NA     mean       sd      var   min   max
-##     <fctr>    <dbl>    <dbl>    <dbl> <dbl> <dbl>
-## 1      !NA 184.8018 91.15230 8308.742     7   334
-## 2       NA 189.5143 87.69478 7690.375    31   332
-

Below, we can plot the distribution of Temperature, plotting for values of temperature when Ozone is missing, and when it is not missing.

-
ggplot(aq_shadow,
-       aes(x = Temp,
-           colour = Ozone_NA)) + 
-  geom_density()
-

-

Binding the shadow here also has great benefits when combined with imputation.

-
-
-

-Visualising imputed values

-

Using the easy-to-use simputation package, we impute values for Ozone, then visualise the data:

-
library(simputation)
-library(dplyr)
-
-airquality %>%
-  impute_lm(Ozone ~ Temp + Wind) %>%
-  ggplot(aes(x = Temp,
-             y = Ozone)) + 
-  geom_point()
-

-

Note that we no longer get any errors regarding missing observations - because they are all imputed! But this comes at a cost: we also no longer have information about where the imputations are - they are now sort of invisible.

-

Using the shadow matrix to keep track of where the missings are, you can actually keep track of the imputations, by colouring by what was previously missing in Ozone.

-
aq_shadow %>%
-  impute_lm(Ozone ~ Temp + Wind) %>%
-  ggplot(aes(x = Temp,
-             y = Ozone,
-             colour = Ozone_NA)) + 
-  geom_point()
-

-
-

-Numerical summaries of missing values

-

narnia also provide numerical summaries for missing data. Two convenient counters of complete values and missings are n_miss and n_complete. These work on both dataframes and vectors, similar to dplyr::n_distinct

-
dplyr::n_distinct(airquality)
-
## [1] 153
-
dplyr::n_distinct(airquality$Ozone)
-
## [1] 68
-
n_miss(airquality)
-
## [1] 44
-
n_miss(airquality$Ozone)
-
## [1] 37
-
n_complete(airquality)
-
## [1] 874
-
n_complete(airquality$Ozone)
-
## [1] 116
-

The syntax for the other numerical sumamries in narnia are miss_, and then case, var, or df, and then summary or table. There are also some summary functions for ts objects that are being worked on, which currently have miss_ts_run and miss_ts_summary functions.

-

To demonstrate, below are the miss_case_* family of functions.

-

miss_case_pct returns a numeric value describing the percent of missing values in the dataframe.

-
miss_case_pct(airquality)
-
## [1] 27.45098
-

miss_case_summary returns a numeric value that describes the number of missings in a given case (aka row), the percent of missings in that row.

-
miss_case_summary(airquality)
-
## # A tibble: 153 x 3
-##     case n_miss  pct_miss
-##    <int>     <int>    <dbl>
-##  1     1         0  0.00000
-##  2     2         0  0.00000
-##  3     3         0  0.00000
-##  4     4         0  0.00000
-##  5     5         2 33.33333
-##  6     6         1 16.66667
-##  7     7         0  0.00000
-##  8     8         0  0.00000
-##  9     9         0  0.00000
-## 10    10         1 16.66667
-## # ... with 143 more rows
-

miss_case_table tabulates the number of missing values in a case / row. Below, this shows the number of missings in a case:

-
    -
  • There are 111 cases with 0 missings, which comprises about 72% of the data.
  • -
  • There are then 40 cases with 1 missing, these make up 26% of the data.
  • -
  • There are then 2 cases with 2 missing - these make up 1% of the data.
  • -
-
miss_case_table(airquality)
-
## # A tibble: 3 x 3
-##   n_miss_in_case n_cases  pct_miss
-##               <int>   <int>    <dbl>
-## 1                 0     111 72.54902
-## 2                 1      40 26.14379
-## 3                 2       2  1.30719
-

There are then the miss_var_* family of functions.

-

Similar to miss_case_pct, miss_var_pct returns the percent of variables that contain a missing value.

-
miss_var_pct(airquality)
-
## [1] 33.33333
-

miss_var_summary then returns the number of missing values in a variable, and the percent missing in that variable.

-
miss_var_summary(airquality)
-
## # A tibble: 6 x 3
-##   variable n_miss   pct_miss
-##      <chr>     <int>     <dbl>
-## 1    Ozone        37 24.183007
-## 2  Solar.R         7  4.575163
-## 3     Wind         0  0.000000
-## 4     Temp         0  0.000000
-## 5    Month         0  0.000000
-## 6      Day         0  0.000000
-

Finally, miss_var_table. This describes the number of missings in a variable.

-
    -
  • There are 4 variables with 0 missings, comprising 66.67% of variables in the dataset.
  • -
  • There is 1 variable with 7 missings
  • -
  • There is 1 variable with 37 missings
  • -
-
miss_var_table(airquality)
-
## # A tibble: 3 x 3
-##   n_miss_in_var n_vars  pct_miss
-##              <int>  <int>    <dbl>
-## 1                0      4 66.66667
-## 2                7      1 16.66667
-## 3               37      1 16.66667
-

There are also summary functions for exploring missings that occur over a particular span or period of the dataset, or the number of missings in a single run:

- -

miss_var_run can be particularly useful in time series data, as it allows you to provide summaries for the number of missings or complete values in a single run. The function miss_var_run() provides a data.frame of the run length of missings and complete values. To explore this function we will use the built-in dataset, pedestrian, which contains hourly counts of pedestrians from four locations around Melbourne, Australia, from 2016.

-

To use miss_var_run, you specify the variable that you want to explore the runs of missingness for, in this case, hourly_counts:

-
miss_var_run(pedestrian,
-             hourly_counts)
-
## # A tibble: 35 x 2
-##    run_length    is_na
-##         <int>    <chr>
-##  1       6628 complete
-##  2          1  missing
-##  3       5250 complete
-##  4        624  missing
-##  5       3652 complete
-##  6          1  missing
-##  7       1290 complete
-##  8        744  missing
-##  9       7420 complete
-## 10          1  missing
-## # ... with 25 more rows
-

miss_var_span() is used to determine the number of missings over a specified repeating span of rows in variable of a dataframe. Similar to miss_var_run, you specify the variable that you wish to explore, you then also specify the size of the span with the span_every argument.

-
miss_var_span(pedestrian,
-              hourly_counts,
-              span_every = 100)
-
## # A tibble: 377 x 5
-##    span_counter n_miss n_complete prop_miss prop_complete
-##           <int>  <int>      <dbl>     <dbl>         <dbl>
-##  1            1      0        100         0             1
-##  2            2      0        100         0             1
-##  3            3      0        100         0             1
-##  4            4      0        100         0             1
-##  5            5      0        100         0             1
-##  6            6      0        100         0             1
-##  7            7      0        100         0             1
-##  8            8      0        100         0             1
-##  9            9      0        100         0             1
-## 10           10      0        100         0             1
-## # ... with 367 more rows
-

The final question we proposed in this vignette was:

-
    -
  1. Can we model missingness?
  2. -
-

Sometimes it can be impractical to explore all of the variables that have missing data. One approach, however, is to model missing data using methods from Tierney et el. (2015).

-

Here, the approach is to predict the proportion of missingness in a given case, using all variables. There is a little helper function to add a column with the proportion of cases or rows missing - add_prop_miss. This created a column named “prop_miss”, which is the proportion of missing values in that row.

-
airquality %>%
-  add_prop_miss() %>%
-  head()
-
## # A tibble: 6 x 7
-##   Ozone Solar.R  Wind  Temp Month   Day prop_miss_all
-##   <int>   <int> <dbl> <int> <int> <int>         <dbl>
-## 1    41     190   7.4    67     5     1     0.0000000
-## 2    36     118   8.0    72     5     2     0.0000000
-## 3    12     149  12.6    74     5     3     0.0000000
-## 4    18     313  11.5    62     5     4     0.0000000
-## 5    NA      NA  14.3    56     5     5     0.3333333
-## 6    28      NA  14.9    66     5     6     0.1666667
-

We can then use a model like decision trees to predict which variables and their values are important for predicting the proportion of missingness:

-
library(rpart)
-library(rpart.plot)
-
-airquality %>%
-  add_prop_miss() %>%
-  rpart(prop_miss_all ~ ., data = .) %>%
-  prp(type = 4, extra = 101, prefix = "Prop. Miss = ")
-

-
# library(visdat)
-# vis_miss(messy_airquality)
-

Here we can see that this produces quite a complex tree - this can be pruned back and the depth of the decision tree controlled.

-
-
-
-

-Summary

-

The tools in narnia help us identify where missingness is, while maintaining a tidy workflow. We care about these mechanisms or these patterns because they can help us understand potential mechanisms, such as equipment failures, and then identify possible solutions based upon this evidence.

-
-
-

-Future development

-
    -
  • Continue making narnia play well with dplyr and tidyr.
  • -
  • Make narnia work with big data tools like sparklyr, and sparklingwater.
  • -
  • Expand ggplot geom_miss_* family.
  • -
  • Further develop methods for handling and visualising imputations, and multiple imputation.
  • -
-
-
-

-Thank you

-

A huge thanks of course to Di Cook and Miles McBain for their assistance on this project, and its development. In particular, I thank Di for providing the large conceptual ideas of how to display missings, and the use of the shadow matrix. I also thank Miles for his instrumental work in getting stat_missing_point and geom_miss_point() working as they do now.

-
-
-

-References

- -
-
-
- - - -
- - -
- -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/ggmissing-facet-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/ggmissing-facet-1.png deleted file mode 100644 index fdd66526..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/ggmissing-facet-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/ggmissing-theme-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/ggmissing-theme-1.png deleted file mode 100755 index 835ad1c3..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/ggmissing-theme-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/rpart-miss-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/rpart-miss-1.png deleted file mode 100644 index 4a53e6ce..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/rpart-miss-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/shadow-plot-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/shadow-plot-1.png deleted file mode 100644 index f3426994..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/shadow-plot-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-1-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-1-1.png deleted file mode 100755 index 75bf05e8..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-1-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-1.png deleted file mode 100755 index b64c71e8..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-2.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-2.png deleted file mode 100755 index 93025ce6..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-2.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-3-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-3-1.png deleted file mode 100644 index 13df31f3..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-3-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-4-1.png deleted file mode 100644 index d172d643..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-4-2.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-4-2.png deleted file mode 100644 index 980dc357..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-4-2.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-7-1.png deleted file mode 100644 index 341b1c9a..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-7-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-8-1.png deleted file mode 100644 index 341b1c9a..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-8-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-9-1.png deleted file mode 100644 index 4c43764b..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/unnamed-chunk-9-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/vis-dat-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/vis-dat-1.png deleted file mode 100755 index e03c5497..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/vis-dat-1.png and /dev/null differ diff --git a/docs/articles/getting-started-w-narnia_files/figure-html/vis-miss-cluster-vanilla-1.png b/docs/articles/getting-started-w-narnia_files/figure-html/vis-miss-cluster-vanilla-1.png deleted file mode 100755 index 8270e003..00000000 Binary files a/docs/articles/getting-started-w-narnia_files/figure-html/vis-miss-cluster-vanilla-1.png and /dev/null differ diff --git a/docs/articles/index.html b/docs/articles/index.html deleted file mode 100644 index ce3653d5..00000000 --- a/docs/articles/index.html +++ /dev/null @@ -1,93 +0,0 @@ - -Articles • naniar - Skip to contents - - -
- - - -
- - - - - - - diff --git a/docs/articles/missingness-data-structures.png b/docs/articles/missingness-data-structures.png deleted file mode 100755 index fb5fd275..00000000 Binary files a/docs/articles/missingness-data-structures.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation.html b/docs/articles/naniar-visualisation.html deleted file mode 100644 index 62ca6866..00000000 --- a/docs/articles/naniar-visualisation.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - - - -Gallery of Missing Data Visualisations • naniar - - - - - - - - - - - - - - - - - Skip to contents - - -
- - - - -
-
- - - -

There are a variety of different plots to explore missing data -available in the naniar package. This vignette simply showcases all of -the visualisations. If you would like to know more about the philosophy -of the naniar package, you should read the vignette Getting -Started with naniar.

-

A key point to remember with the visualisation tools in -naniar is that there is a way to get the data from the plot -out from the visualisation.

-
-

Getting started -

-

One of the first plots that I recommend you start with when you are -first exploring your missing data, is the vis_miss() plot, -which is re-exported from visdat.

-
-library(naniar)
-
-vis_miss(airquality)
-

-

This plot provides a specific visualiation of the amount of missing -data, showing in black the location of missing values, and also -providing information on the overall percentage of missing values -overall (in the legend), and in each variable.

-
-

Exploring patterns with UpSetR -

-

An upset plot from the UpSetR package can be used to -visualise the patterns of missingness, or rather the combinations of -missingness across cases. To see combinations of missingness and -intersections of missingness amongst variables, use the -gg_miss_upset function:

-
-gg_miss_upset(airquality)
-

-

This tells us:

-
    -
  • Only Ozone and Solar.R have missing values
  • -
  • Ozone has the most missing values
  • -
  • There are 2 cases where both Solar.R and Ozone have missing values -together
  • -
-

We can explore this with more complex data, such as riskfactors:

-
-gg_miss_upset(riskfactors)
-

-

The default option of gg_miss_upset is taken from -UpSetR::upset - which is to use up to 5 sets and up to 40 -interactions. Here, setting nsets = 5 means to look at 5 -variables and their combinations. The number of combinations or rather -intersections is controlled by nintersects. -You could, for example look at all of the number of missing variables -using n_var_miss:

-
-# how many missings?
-n_var_miss(riskfactors)
-
## [1] 24
-
-gg_miss_upset(riskfactors, nsets = n_var_miss(riskfactors))
-

-

If there are 40 intersections, there will be up to 40 combinations of -variables explored. The number of sets and intersections can be changed -by passing arguments nsets = 10 to look at 10 sets of -variables, and nintersects = 50 to look at 50 -intersections.

-
-gg_miss_upset(riskfactors, 
-              nsets = 10,
-              nintersects = 50)
-

-

Setting nintersects to NA it will plot all -sets and all intersections.

-
-gg_miss_upset(riskfactors, 
-              nsets = 10,
-              nintersects = NA)
-

-
-
-
-

Exploring Missingness Mechanisms -

-

There are a few different ways to explore different missing data -mechanisms and relationships. One way incorporates the method of -shifting missing values so that they can be visualised on the same axes -as the regular values, and then colours the missing and not missing -points. This is implemented with geom_miss_point().

-
-

-geom_miss_point -

-
-library(ggplot2)
-# using regular geom_point()
-ggplot(airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
-geom_point()
-
## Warning: Removed 42 rows containing missing values (`geom_point()`).
-

-
-library(naniar)
-
-# using  geom_miss_point()
-ggplot(airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
- geom_miss_point()
-

-
-# Facets!
-ggplot(airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
- geom_miss_point() + 
- facet_wrap(~Month)
-

-
-# Themes
-ggplot(airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
- geom_miss_point() + 
- theme_dark()
-

-
-
-
-

General visual summaries of missing data -

-

Here are some function that provide quick summaries of missingness in -your data, they all start with gg_miss_ - so that they are -easy to remember and tab-complete.

-
-

Missingness in variables with gg_miss_var -

-

This plot shows the number of missing values in each variable in a -dataset. It is powered by the miss_var_summary() -function.

-
-gg_miss_var(airquality)
-

-
-library(ggplot2)
-gg_miss_var(airquality) + labs(y = "Look at all the missing ones")
-

-

If you wish, you can also change whether to show the % of missing -instead with show_pct = TRUE.

-
-gg_miss_var(airquality, show_pct = TRUE)
-

-

You can also plot the number of missings in a variable grouped by -another variable using the facet argument.

-
-gg_miss_var(airquality,
-            facet = Month)
-

-
-
-

Missingness in cases with gg_miss_case -

-

This plot shows the number of missing values in each case. It is -powered by the miss_case_summary() function.

-
-gg_miss_case(airquality)
-

-
-gg_miss_case(airquality) + labs(x = "Number of Cases")
-

-

You can also order by the number of cases using -order_cases = TRUE

-
-gg_miss_case(airquality, order_cases = TRUE)
-

-

You can also explore the missingness in cases over some variable -using facet = Month

-
-gg_miss_case(airquality, facet = Month)
-

-
-
-

Missingness across factors with gg_miss_fct -

-

This plot shows the number of missings in each column, broken down by -a categorical variable from the dataset. It is powered by a -dplyr::group_by statement followed by -miss_var_summary().

-
-gg_miss_fct(x = riskfactors, fct = marital)
-
## Warning: There was 1 warning in `mutate()`.
-##  In argument: `marital = (function (x) ...`.
-## Caused by warning:
-## ! `fct_explicit_na()` was deprecated in forcats 1.0.0.
-##  Please use `fct_na_value_to_level()` instead.
-##  The deprecated feature was likely used in the naniar package.
-##   Please report the issue at <https://github.com/njtierney/naniar/issues>.
-

-
-library(ggplot2)
-gg_miss_fct(x = riskfactors, fct = marital) + labs(title = "NA in Risk Factors and Marital status")
-

-
-# using group_by
-library(dplyr)
-
## 
-## Attaching package: 'dplyr'
-
## The following objects are masked from 'package:stats':
-## 
-##     filter, lag
-
## The following objects are masked from 'package:base':
-## 
-##     intersect, setdiff, setequal, union
-
-riskfactors %>%
-  group_by(marital) %>%
-  miss_var_summary()
-
## # A tibble: 231 × 4
-## # Groups:   marital [7]
-##    marital variable      n_miss pct_miss
-##    <fct>   <chr>          <int>    <dbl>
-##  1 Married smoke_stop       120    91.6 
-##  2 Married pregnant         117    89.3 
-##  3 Married smoke_last        84    64.1 
-##  4 Married smoke_days        73    55.7 
-##  5 Married drink_average     68    51.9 
-##  6 Married health_poor       67    51.1 
-##  7 Married drink_days        67    51.1 
-##  8 Married weight_lbs         6     4.58
-##  9 Married bmi                6     4.58
-## 10 Married diet_fruit         4     3.05
-## # ℹ 221 more rows
-

gg_miss_fct can also be used to explore missingness -along time, like so:

-
-gg_miss_fct(oceanbuoys, year)
-

-
-# to load who data
-library(tidyr)
-gg_miss_fct(who, year)
-

-

(Thanks to Maria Paula -Caldas for inspiration for this visualisation, discussed -here)

-
-
-

Missingness along a repeating span with -gg_miss_span -

-

This plot shows the number of missings in a given span, or breaksize, -for a single selected variable. In this case we look at the span of -hourly_counts from the pedestrian dataset. It is powered by -the miss_var_span function

-
-# data method
-
-miss_var_span(pedestrian, hourly_counts, span_every = 3000)
-
## # A tibble: 13 × 6
-##    span_counter n_miss n_complete prop_miss prop_complete n_in_span
-##           <int>  <int>      <int>     <dbl>         <dbl>     <int>
-##  1            1      0       3000  0                1          3000
-##  2            2      0       3000  0                1          3000
-##  3            3      1       2999  0.000333         1.00       3000
-##  4            4    121       2879  0.0403           0.960      3000
-##  5            5    503       2497  0.168            0.832      3000
-##  6            6    555       2445  0.185            0.815      3000
-##  7            7    190       2810  0.0633           0.937      3000
-##  8            8      0       3000  0                1          3000
-##  9            9      1       2999  0.000333         1.00       3000
-## 10           10      0       3000  0                1          3000
-## 11           11      0       3000  0                1          3000
-## 12           12    745       2255  0.248            0.752      3000
-## 13           13    432       1268  0.254            0.746      1700
-
-gg_miss_span(pedestrian, hourly_counts, span_every = 3000)
-

-
-# works with the rest of ggplot
-gg_miss_span(pedestrian, hourly_counts, span_every = 3000) + labs(x = "custom")
-

-
-gg_miss_span(pedestrian, hourly_counts, span_every = 3000) + theme_dark()
-

-

You can also explore miss_var_span by group with the -facet argument.

-
-gg_miss_span(pedestrian, 
-             hourly_counts, 
-             span_every = 3000, 
-             facet = sensor_name)
-

-
-
-

-gg_miss_case_cumsum -

-

This plot shows the cumulative sum of missing values, reading the -rows of the dataset from the top to bottom. It is powered by the -miss_case_cumsum() function.

-
-gg_miss_case_cumsum(airquality)
-

-
-library(ggplot2)
-gg_miss_case_cumsum(riskfactors, breaks = 50) + theme_bw()
-

-
-
-

-gg_miss_var_cumsum -

-

This plot shows the cumulative sum of missing values, reading columns -from the left to the right of your dataframe. It is powered by the -miss_var_cumsum() function.

-
-gg_miss_var_cumsum(airquality)
-

-
-
-

-gg_miss_which -

-

This plot shows a set of rectangles that indicate whether there is a -missing element in a column or not.

-
-gg_miss_which(airquality)
-

-
-
-
-
- - - - -
- - - - - - - diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-1.png deleted file mode 100644 index f11cc3ce..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-2.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-2.png deleted file mode 100644 index a0f4baf7..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-2.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-cumsum-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-cumsum-1.png deleted file mode 100644 index 02f5ed4d..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-cumsum-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-cumsum-2.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-cumsum-2.png deleted file mode 100644 index 6325c45f..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-cumsum-2.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-group-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-group-1.png deleted file mode 100644 index b941f5fb..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-group-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-order-by-case-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-order-by-case-1.png deleted file mode 100644 index f11cc3ce..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-case-order-by-case-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-fct-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-fct-1.png deleted file mode 100644 index 8785df78..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-fct-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-fct-2.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-fct-2.png deleted file mode 100644 index 7e043cd5..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-fct-2.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-1.png deleted file mode 100644 index fd01203d..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-2.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-2.png deleted file mode 100644 index 96c9b2c5..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-2.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-3.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-3.png deleted file mode 100644 index bb007c56..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-3.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-group-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-group-1.png deleted file mode 100644 index 5b070b32..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-span-group-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-1.png deleted file mode 100644 index bb612004..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-n-sets-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-n-sets-1.png deleted file mode 100644 index 85e141cf..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-n-sets-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-n-var-miss-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-n-var-miss-1.png deleted file mode 100644 index 1e1494fb..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-n-var-miss-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-nintersect-NA-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-nintersect-NA-1.png deleted file mode 100644 index 85e141cf..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-upset-nintersect-NA-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-1.png deleted file mode 100644 index b43c0051..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-2.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-2.png deleted file mode 100644 index 3839b006..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-2.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-cumsum-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-cumsum-1.png deleted file mode 100644 index d7017802..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-cumsum-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-group-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-group-1.png deleted file mode 100644 index 69195201..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-group-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-show-pct-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-show-pct-1.png deleted file mode 100644 index 4267fbea..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-var-show-pct-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-which-1.png b/docs/articles/naniar-visualisation_files/figure-html/gg-miss-which-1.png deleted file mode 100644 index e4a53ca0..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/gg-miss-which-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-1.png b/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-1.png deleted file mode 100644 index 15f0e34c..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-2.png b/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-2.png deleted file mode 100644 index aaf45dc7..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-2.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-3.png b/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-3.png deleted file mode 100644 index d73e3de2..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-3.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-4.png b/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-4.png deleted file mode 100644 index 8d14d9c8..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/ggplot-geom-miss-point-4.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/unnamed-chunk-1-1.png b/docs/articles/naniar-visualisation_files/figure-html/unnamed-chunk-1-1.png deleted file mode 100644 index a4c75dfb..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/unnamed-chunk-1-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/upset-plot-1.png b/docs/articles/naniar-visualisation_files/figure-html/upset-plot-1.png deleted file mode 100644 index 1d71d499..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/upset-plot-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/upset-plot-riskfactors-1.png b/docs/articles/naniar-visualisation_files/figure-html/upset-plot-riskfactors-1.png deleted file mode 100644 index 665ff4e3..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/upset-plot-riskfactors-1.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/upset-plot-riskfactors-2.png b/docs/articles/naniar-visualisation_files/figure-html/upset-plot-riskfactors-2.png deleted file mode 100644 index 7efe47c9..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/upset-plot-riskfactors-2.png and /dev/null differ diff --git a/docs/articles/naniar-visualisation_files/figure-html/vis-miss-1.png b/docs/articles/naniar-visualisation_files/figure-html/vis-miss-1.png deleted file mode 100644 index 15a48d43..00000000 Binary files a/docs/articles/naniar-visualisation_files/figure-html/vis-miss-1.png and /dev/null differ diff --git a/docs/articles/replace-with-na.html b/docs/articles/replace-with-na.html deleted file mode 100644 index 1475f755..00000000 --- a/docs/articles/replace-with-na.html +++ /dev/null @@ -1,467 +0,0 @@ - - - - - - - - -Replacing values with NA • naniar - - - - - - - - - - - - - - - - - Skip to contents - - -
- - - - -
-
- - - -

When dealing with missing values, you might want to replace values -with a missing values (NA). This is useful in cases when -you know the origin of the data and can be certain which values should -be missing. For example, you might know that all values of “N/A”, “N A”, -and “Not Available”, or -99, or -1 are supposed to be missing.

-

naniar provides functions to specifically work on this -type of problem using the function replace_with_na(). This -function is the compliment to tidyr::replace_na(), which -replaces an NA value with a specified value, whereas -naniar::replace_with_na() replaces a value with an NA:

- -

In this vignette, we describe some simple use cases for these -functions and describe how they work.

-
-

Example data -

-

First, we introduce a small fictional dataset, df, which -contains some common features of a dataset with the sorts of missing -values we might encounter. This includes multiple specifications of -missing values, such as “N/A”, “N A”, and “Not Available”. And also some -common numeric codes, like -98, -99, and -1.

-
-
-df <- tibble::tribble(
-  ~name,           ~x,  ~y,              ~z,  
-  "N/A",           1,   "N/A",           -100, 
-  "N A",           3,   "NOt available", -99,
-  "N / A",         NA,  "29",              -98,
-  "Not Available", -99, "25",              -101,
-  "John Smith",    -98, "28",              -1)
-
-

Using replace_with_na -

-

What if we want to replace the value -99 in the x column -with a missing value?

-

First, let’s load naniar:

- -

Now, we specify the fact that we want to replace -99 with a missing -value. To do so we use the replace argument, and specify a -named list, which contains the names of the variable and the value it -would take to replace with NA.

-
-df %>% replace_with_na(replace = list(x = -99))
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 N/A               1 N/A            -100
-#> 2 N A               3 NOt available   -99
-#> 3 N / A            NA 29              -98
-#> 4 Not Available    NA 25             -101
-#> 5 John Smith      -98 28               -1
-

And say we want to replace -98 as well?

-
-df %>%
-  replace_with_na(replace = list(x = c(-99, -98)))
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 N/A               1 N/A            -100
-#> 2 N A               3 NOt available   -99
-#> 3 N / A            NA 29              -98
-#> 4 Not Available    NA 25             -101
-#> 5 John Smith       NA 28               -1
-

And then what if we want to replace -99 and -98 in all the numeric -columns, x and z?

-
-df %>%
-  replace_with_na(replace = list(x = c(-99,-98),
-                             z = c(-99, -98)))
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 N/A               1 N/A            -100
-#> 2 N A               3 NOt available    NA
-#> 3 N / A            NA 29               NA
-#> 4 Not Available    NA 25             -101
-#> 5 John Smith       NA 28               -1
-

Using replace_with_na() works well when we know the -exact value to be replaced, and for which variables we want to replace, -providing there are not many variables. But what do you do when you’ve -got many variables you want to observe?

-
-
-

Extending replace_with_na -

-

Sometimes you have many of the same value that you want to replace. -For example, -99 and -98 above, and also the variants of “NA”, such as -“N/A”, and “N / A”, and “Not Available”. You might also have certain -variables that you want to be affected by these rules, or you might have -more complex rules, like, “only affect variables that are numeric, or -character, with this rule”.

-

To account for these cases we have borrowed from dplyr’s -scoped variants and created the functions:

-
    -
  • -replace_with_na_all() Replaces NA for all -variables.
  • -
  • -replace_with_na_at() Replaces NA on a subset of -variables specified with character quotes (e.g., c(“var1”, -“var2”)).
  • -
  • -replace_with_na_if() Replaces NA based on applying an -operation on the subset of variables for which a predicate function -(is.numeric, is.character, etc) returns TRUE.
  • -
-

Below we will now consider some very simple examples of the use of -these functions, so that you can better understand how to use them.

-
-
-

Using replace_with_na_all -

-

Use replace_with_na_all() when you want to replace ALL -values that meet a condition across an entire dataset. The syntax here -is a little different, and follows the rules for rlang’s expression of -simple functions. This means that the function starts with -~, and when referencing a variable, you use -.x.

-

For example, if we want to replace all cases of -99 in our dataset, -we write:

-
-
-df %>% replace_with_na_all(condition = ~.x == -99)
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 N/A               1 N/A            -100
-#> 2 N A               3 NOt available    NA
-#> 3 N / A            NA 29              -98
-#> 4 Not Available    NA 25             -101
-#> 5 John Smith      -98 28               -1
-

Likewise, if you have a set of (annoying) repeating strings like -various spellings of “NA”, then I suggest you first lay out all the -offending cases:

-
-
-# write out all the offending strings
-na_strings <- c("NA", "N A", "N / A", "N/A", "N/ A", "Not Available", "NOt available")
-

Then you write ~.x %in% na_strings - which reads as -“does this value occur in the list of NA strings”.

-
-
-df %>%
-  replace_with_na_all(condition = ~.x %in% na_strings)
-#> # A tibble: 5 × 4
-#>   name           x y         z
-#>   <chr>      <dbl> <chr> <dbl>
-#> 1 NA             1 NA     -100
-#> 2 NA             3 NA      -99
-#> 3 NA            NA 29      -98
-#> 4 NA           -99 25     -101
-#> 5 John Smith   -98 28       -1
-

You can also use the built-in strings and numbers in naniar:

-
    -
  • common_na_numbers
  • -
  • common_na_strings
  • -
-
-common_na_numbers
-#> [1]    -9   -99  -999 -9999  9999    66    77    88
-common_na_strings
-#>  [1] "missing" "NA"      "N A"     "N/A"     "#N/A"    "NA "     " NA"    
-#>  [8] "N /A"    "N / A"   " N / A"  "N / A "  "na"      "n a"     "n/a"    
-#> [15] "na "     " na"     "n /a"    "n / a"   " a / a"  "n / a "  "NULL"   
-#> [22] "null"    ""        "\\?"     "\\*"     "\\."
-

And you can replace values matching those strings or numbers like -so:

-
-df %>%
-  replace_with_na_all(condition = ~.x %in% common_na_strings)
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 NA                1 NA             -100
-#> 2 NA                3 NOt available   -99
-#> 3 NA               NA 29              -98
-#> 4 Not Available   -99 25             -101
-#> 5 John Smith      -98 28               -1
-
-

-replace_with_na_at -

-

This is similar to _all, but instead in this case you -can specify the variables that you want affected by the rule that you -state. This is useful in cases where you want to specify a rule that -only affects a selected number of variables.

-
-
-df %>% 
-  replace_with_na_at(.vars = c("x","z"),
-                     condition = ~.x == -99)
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 N/A               1 N/A            -100
-#> 2 N A               3 NOt available    NA
-#> 3 N / A            NA 29              -98
-#> 4 Not Available    NA 25             -101
-#> 5 John Smith      -98 28               -1
-

Although you can achieve this with regular -replace_with_na(), it is more concise to use, -replace_with_na_at(). Additionally, you can specify rules -as function, for example, make a value NA if the exponent of that number -is less than 1:

-
-
-df %>% 
-  replace_with_na_at(.vars = c("x","z"),
-                     condition = ~ exp(.x) < 1)
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 N/A               1 N/A              NA
-#> 2 N A               3 NOt available    NA
-#> 3 N / A            NA 29               NA
-#> 4 Not Available    NA 25               NA
-#> 5 John Smith       NA 28               NA
-
-
-

-replace_with_na_if -

-

There may be some cases where you can identify variables based on -some test - is.character() - are they character variables? -is.numeric() - Are they numeric or double? and a given -value inside that type of data. For example,

-
-
-df %>%
-  replace_with_na_if(.predicate = is.character,
-                     condition = ~.x %in% ("N/A"))
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 NA                1 NA             -100
-#> 2 N A               3 NOt available   -99
-#> 3 N / A            NA 29              -98
-#> 4 Not Available   -99 25             -101
-#> 5 John Smith      -98 28               -1
-
-# or
-df %>%
-  replace_with_na_if(.predicate = is.character,
-                     condition = ~.x %in% (na_strings))
-#> # A tibble: 5 × 4
-#>   name           x y         z
-#>   <chr>      <dbl> <chr> <dbl>
-#> 1 NA             1 NA     -100
-#> 2 NA             3 NA      -99
-#> 3 NA            NA 29      -98
-#> 4 NA           -99 25     -101
-#> 5 John Smith   -98 28       -1
-

This means that you are able to apply a rule to many variables that -meet a pre-specified condition. This can be of particular use if you -have many variables and don’t want to list them all, and also if you -know that there is a particular problem for variables of a particular -class.

-
-
-
-
-

Notes on alternative ways to handle replacing with NAs -

-

There are some alternative ways to handle replacing values with NA in -the tidyverse, na_if and using readr. These -are ultimately not as expressive as the replace_with_na() -functions, but they are very useful if you only have one kind of value -to replace with a missing, and if you know what the missing values are -upon reading in the data.

-

dplyr::na_if

-

This function allows you to replace exact values - similar to -replace_with_na(), but only for one single column in a data -frame. Here is how you would use it in our examples.

-
-
-# instead of:
-df_1 <- df %>% replace_with_na_all(condition = ~.x == -99)
-df_1
-#> # A tibble: 5 × 4
-#>   name              x y                 z
-#>   <chr>         <dbl> <chr>         <dbl>
-#> 1 N/A               1 N/A            -100
-#> 2 N A               3 NOt available    NA
-#> 3 N / A            NA 29              -98
-#> 4 Not Available    NA 25             -101
-#> 5 John Smith      -98 28               -1
-
-df_2 <- df %>% dplyr::mutate(
-  x = dplyr::na_if(x, -99),
-  y = dplyr::na_if(z, -99)
-)
-df_2
-#> # A tibble: 5 × 4
-#>   name              x     y     z
-#>   <chr>         <dbl> <dbl> <dbl>
-#> 1 N/A               1  -100  -100
-#> 2 N A               3    NA   -99
-#> 3 N / A            NA   -98   -98
-#> 4 Not Available    NA  -101  -101
-#> 5 John Smith      -98    -1    -1
-
-# are they the same?
-all.equal(df_1, df_2)
-#> [1] "Component \"y\": Modes: character, numeric"                       
-#> [2] "Component \"y\": target is character, current is numeric"         
-#> [3] "Component \"z\": 'is.NA' value mismatch: 0 in current 1 in target"
-

Note, however, that na_if() can only take arguments of -length one. This means that it cannot capture other statements like

-
-
-na_strings <- c("NA", "N A", "N / A", "N/A", "N/ A", "Not Available", "NOt available")
-df_3 <- df %>% replace_with_na_all(condition = ~.x %in% na_strings)
-
-
-# Not run:
-df_4 <- df %>% dplyr::na_if(x = ., y = na_strings)
-# Error in check_length(y, x, fmt_args("y"), glue("same as {fmt_args(~x)}")) : 
-  # argument "y" is missing, with no default
-

It also cannot handle more complex equations, where you want to refer -to values in other columns, or values less than or greater than another -value.

-

catch NAs with readr

-

When reading in your data, you can use the na argument -inside readr to replace certain values with NA. For -example:

-
-# not run
-dat_raw <- readr::read_csv("original.csv", na = na_strings)
-

This would convert all of the values in na_strings into -missing values.

-

This is useful to use if you happen to know the NA types upon reading -in the data. However, this is not always practical in a data analysis -pipeline.

-
-
-
- - - - -
- - - - - - - diff --git a/docs/articles/special-missing-values.html b/docs/articles/special-missing-values.html deleted file mode 100644 index 118e801b..00000000 --- a/docs/articles/special-missing-values.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - -Special Missing Values • naniar - - - - - - - - - - - - - - - - - Skip to contents - - -
- - - - -
-
- - - -

Data sometimes have special missing values to indicate specific -reasons for missingness. For example, “9999” is sometimes used in -weather data, say for for example, the Global -Historical Climate Network (GHCN) data, to indicate specific types -of missingness, such as instrument failure.

-

You might be interested in creating your own special missing values -so that you can mark specific, known reasons for missingness. For -example, an individual dropping out of a study, known instrument failure -in weather instruments, or for values being censored in analysis. In -these cases, the data is missing, but we have information about -why it is missing. Coding these cases as NA would -cause us to lose this valuable information. Other stats programming -languages like STATA, SAS, and SPSS have this capacity, but currently -R does not. So, we need a way to create these special -missing values.

-

We can use recode_shadow to recode missingness by -recoding the special missing value as something like -NA_reason. naniar records these values in the -shadow part of nabular data, which is a -special dataframe that contains missingness information.

-

This vignette describes how to add special missing values using the -recode_shadow() function. First we consider some -terminology to explain these ideas, if you are not familiar with the -workflows in naniar.

-
-

Terminology -

-

Missing data can be represented as a binary matrix of “missing” or -“not missing”, which in naniar we call a “shadow matrix”, a -term borrowed from Swayne -and Buja, 1998.

-
-library(naniar)
-as_shadow(oceanbuoys)
-#> # A tibble: 736 × 8
-#>    year_NA latitude_NA longitude_NA sea_temp_c_NA air_temp_c_NA humidity_NA
-#>    <fct>   <fct>       <fct>        <fct>         <fct>         <fct>      
-#>  1 !NA     !NA         !NA          !NA           !NA           !NA        
-#>  2 !NA     !NA         !NA          !NA           !NA           !NA        
-#>  3 !NA     !NA         !NA          !NA           !NA           !NA        
-#>  4 !NA     !NA         !NA          !NA           !NA           !NA        
-#>  5 !NA     !NA         !NA          !NA           !NA           !NA        
-#>  6 !NA     !NA         !NA          !NA           !NA           !NA        
-#>  7 !NA     !NA         !NA          !NA           !NA           !NA        
-#>  8 !NA     !NA         !NA          !NA           !NA           !NA        
-#>  9 !NA     !NA         !NA          !NA           !NA           !NA        
-#> 10 !NA     !NA         !NA          !NA           !NA           !NA        
-#> # ℹ 726 more rows
-#> # ℹ 2 more variables: wind_ew_NA <fct>, wind_ns_NA <fct>
-

The shadow matrix has three key features to facilitate -analysis

-
    -
  1. Coordinated names: Variables in the shadow matrix gain the same -name as in the data, with the suffix “_NA”.

  2. -
  3. Special missing values: Values in the shadow matrix can be -“special” missing values, indicated as NA_suffix, where -“suffix” is a very short message of the type of missings.

  4. -
  5. Cohesiveness: Binding the shadow matrix column-wise to the -original data creates a cohesive “nabular” data form, useful for -visualization and summaries.

  6. -
-

We create nabular data by binding the -shadow to the data:

-
-bind_shadow(oceanbuoys)
-#> # A tibble: 736 × 16
-#>     year latitude longitude sea_temp_c air_temp_c humidity wind_ew wind_ns
-#>    <dbl>    <dbl>     <dbl>      <dbl>      <dbl>    <dbl>   <dbl>   <dbl>
-#>  1  1997        0      -110       27.6       27.1     79.6   -6.40    5.40
-#>  2  1997        0      -110       27.5       27.0     75.8   -5.30    5.30
-#>  3  1997        0      -110       27.6       27       76.5   -5.10    4.5 
-#>  4  1997        0      -110       27.6       26.9     76.2   -4.90    2.5 
-#>  5  1997        0      -110       27.6       26.8     76.4   -3.5     4.10
-#>  6  1997        0      -110       27.8       26.9     76.7   -4.40    1.60
-#>  7  1997        0      -110       28.0       27.0     76.5   -2       3.5 
-#>  8  1997        0      -110       28.0       27.1     78.3   -3.70    4.5 
-#>  9  1997        0      -110       28.0       27.2     78.6   -4.20    5   
-#> 10  1997        0      -110       28.0       27.2     76.9   -3.60    3.5 
-#> # ℹ 726 more rows
-#> # ℹ 8 more variables: year_NA <fct>, latitude_NA <fct>, longitude_NA <fct>,
-#> #   sea_temp_c_NA <fct>, air_temp_c_NA <fct>, humidity_NA <fct>,
-#> #   wind_ew_NA <fct>, wind_ns_NA <fct>
-

This keeps the data values tied to their missingness, and has great -benefits for exploring missing and imputed values in data. See the -vignettes Getting -Started with naniar and Exploring -Imputations with naniar for more details.

-
-
-

Recoding missing values -

-

To demonstrate recoding of missing values, we use a toy dataset, -dat:

-
-df <- tibble::tribble(
-~wind, ~temp,
--99,    45,
-68,    NA,
-72,    25
-)
-
-df
-#> # A tibble: 3 × 2
-#>    wind  temp
-#>   <dbl> <dbl>
-#> 1   -99    45
-#> 2    68    NA
-#> 3    72    25
-

To recode the value -99 as a missing value “broken_machine”, we first -create nabular data with bind_shadow:

-
-
-dfs <- bind_shadow(df)
-
-dfs
-#> # A tibble: 3 × 4
-#>    wind  temp wind_NA temp_NA
-#>   <dbl> <dbl> <fct>   <fct>  
-#> 1   -99    45 !NA     !NA    
-#> 2    68    NA !NA     NA     
-#> 3    72    25 !NA     !NA
-

Special types of missingness are encoded in the shadow part nabular -data, using the recode_shadow function, we can recode the -missing values like so:

-
-dfs_recode <- dfs %>% 
-  recode_shadow(wind = .where(wind == -99 ~ "broken_machine"))
-

This reads as “recode shadow for wind where wind is equal to -99, and -give it the label”broken_machine”. The .where function is -used to help make our intent clearer, and reads very much like the -dplyr::case_when() function, but takes care of encoding -extra factor levels into the missing data.

-

The extra types of missingness are recoded in the shadow part of the -nabular data as additional factor levels:

-
-levels(dfs_recode$wind_NA)
-#> [1] "!NA"               "NA"                "NA_broken_machine"
-levels(dfs_recode$temp_NA)
-#> [1] "!NA"               "NA"                "NA_broken_machine"
-

All additional types of missingness are recorded across all shadow -variables, even if those variables don’t contain that special missing -value. This ensures all flavours of missingness are known.

-

To summarise, to use recode_shadow, the user provides -the following information:

-
    -
  • A variable that they want to effect -(recode_shadow(var = ...))
  • -
  • A condition that they want to implement -(.where(condition ~ ...))
  • -
  • A suffix for the new type of missing value -(.where(condition ~ suffix))
  • -
-

Under the hood, this special missing value is recoded as a new factor -level in the shadow matrix, so that every column is aware of all -possible new values of missingness.

-

Some examples of using recode_shadow in a workflow will -be discussed in more detail in the near future, for the moment, here is -a recommended workflow:

- -
-
-
- - - - -
- - - - - - - diff --git a/docs/authors.html b/docs/authors.html deleted file mode 100644 index 353e0679..00000000 --- a/docs/authors.html +++ /dev/null @@ -1,136 +0,0 @@ - -Authors and Citation • naniar - Skip to contents - - -
-
-
- -
-

Authors

- -
  • -

    Nicholas Tierney. Author, maintainer. -

    -
  • -
  • -

    Di Cook. Author. -

    -
  • -
  • -

    Miles McBain. Author. -

    -
  • -
  • -

    Colin Fay. Author. -

    -
  • -
  • -

    Mitchell O'Hara-Wild. Contributor. -

    -
  • -
  • -

    Jim Hester. Contributor. -

    -
  • -
  • -

    Luke Smith. Contributor. -

    -
  • -
  • -

    Andrew Heiss. Contributor. -

    -
  • -
- -
-

Citation

-

Source: inst/CITATION

- -

Tierney N, Cook D (2023). -“Expanding Tidy Data Principles to Facilitate Missing Data Exploration, Visualization and Assessment of Imputations.” -Journal of Statistical Software, 105(7), 1–31. -doi:10.18637/jss.v105.i07. -

-
@Article{,
-  title = {Expanding Tidy Data Principles to Facilitate Missing Data Exploration, Visualization and Assessment of Imputations},
-  author = {Nicholas Tierney and Dianne Cook},
-  journal = {Journal of Statistical Software},
-  year = {2023},
-  volume = {105},
-  number = {7},
-  pages = {1--31},
-  doi = {10.18637/jss.v105.i07},
-}
-
-
- - -
- - - - - - - diff --git a/docs/docsearch.css b/docs/docsearch.css deleted file mode 100644 index e5f1fe1d..00000000 --- a/docs/docsearch.css +++ /dev/null @@ -1,148 +0,0 @@ -/* Docsearch -------------------------------------------------------------- */ -/* - Source: https://github.com/algolia/docsearch/ - License: MIT -*/ - -.algolia-autocomplete { - display: block; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1 -} - -.algolia-autocomplete .ds-dropdown-menu { - width: 100%; - min-width: none; - max-width: none; - padding: .75rem 0; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, .1); - box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); -} - -@media (min-width:768px) { - .algolia-autocomplete .ds-dropdown-menu { - width: 175% - } -} - -.algolia-autocomplete .ds-dropdown-menu::before { - display: none -} - -.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { - padding: 0; - background-color: rgb(255,255,255); - border: 0; - max-height: 80vh; -} - -.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { - margin-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion { - padding: 0; - overflow: visible -} - -.algolia-autocomplete .algolia-docsearch-suggestion--category-header { - padding: .125rem 1rem; - margin-top: 0; - font-size: 1.3em; - font-weight: 500; - color: #00008B; - border-bottom: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { - float: none; - padding-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { - float: none; - width: auto; - padding: 0; - text-align: left -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content { - float: none; - width: auto; - padding: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content::before { - display: none -} - -.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { - padding-top: .75rem; - margin-top: .75rem; - border-top: 1px solid rgba(0, 0, 0, .1) -} - -.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { - display: block; - padding: .1rem 1rem; - margin-bottom: 0.1; - font-size: 1.0em; - font-weight: 400 - /* display: none */ -} - -.algolia-autocomplete .algolia-docsearch-suggestion--title { - display: block; - padding: .25rem 1rem; - margin-bottom: 0; - font-size: 0.9em; - font-weight: 400 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--text { - padding: 0 1rem .5rem; - margin-top: -.25rem; - font-size: 0.8em; - font-weight: 400; - line-height: 1.25 -} - -.algolia-autocomplete .algolia-docsearch-footer { - width: 110px; - height: 20px; - z-index: 3; - margin-top: 10.66667px; - float: right; - font-size: 0; - line-height: 0; -} - -.algolia-autocomplete .algolia-docsearch-footer--logo { - background-image: url("data:image/svg+xml;utf8,"); - background-repeat: no-repeat; - background-position: 50%; - background-size: 100%; - overflow: hidden; - text-indent: -9000px; - width: 100%; - height: 100%; - display: block; - transform: translate(-8px); -} - -.algolia-autocomplete .algolia-docsearch-suggestion--highlight { - color: #FF8C00; - background: rgba(232, 189, 54, 0.1) -} - - -.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { - box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) -} - -.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { - background-color: rgba(192, 192, 192, .15) -} diff --git a/docs/docsearch.js b/docs/docsearch.js deleted file mode 100644 index b35504cd..00000000 --- a/docs/docsearch.js +++ /dev/null @@ -1,85 +0,0 @@ -$(function() { - - // register a handler to move the focus to the search bar - // upon pressing shift + "/" (i.e. "?") - $(document).on('keydown', function(e) { - if (e.shiftKey && e.keyCode == 191) { - e.preventDefault(); - $("#search-input").focus(); - } - }); - - $(document).ready(function() { - // do keyword highlighting - /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ - var mark = function() { - - var referrer = document.URL ; - var paramKey = "q" ; - - if (referrer.indexOf("?") !== -1) { - var qs = referrer.substr(referrer.indexOf('?') + 1); - var qs_noanchor = qs.split('#')[0]; - var qsa = qs_noanchor.split('&'); - var keyword = ""; - - for (var i = 0; i < qsa.length; i++) { - var currentParam = qsa[i].split('='); - - if (currentParam.length !== 2) { - continue; - } - - if (currentParam[0] == paramKey) { - keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); - } - } - - if (keyword !== "") { - $(".contents").unmark({ - done: function() { - $(".contents").mark(keyword); - } - }); - } - } - }; - - mark(); - }); -}); - -/* Search term highlighting ------------------------------*/ - -function matchedWords(hit) { - var words = []; - - var hierarchy = hit._highlightResult.hierarchy; - // loop to fetch from lvl0, lvl1, etc. - for (var idx in hierarchy) { - words = words.concat(hierarchy[idx].matchedWords); - } - - var content = hit._highlightResult.content; - if (content) { - words = words.concat(content.matchedWords); - } - - // return unique words - var words_uniq = [...new Set(words)]; - return words_uniq; -} - -function updateHitURL(hit) { - - var words = matchedWords(hit); - var url = ""; - - if (hit.anchor) { - url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; - } else { - url = hit.url + '?q=' + escape(words.join(" ")); - } - - return url; -} diff --git a/docs/docsearch.json b/docs/docsearch.json deleted file mode 100644 index 996da0d9..00000000 --- a/docs/docsearch.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "index_name": "naniar", - "start_urls": [ - { - "url": "http://naniar.njtierney.com//index.html", - "selectors_key": "homepage", - "tags": [ - "homepage" - ] - }, - { - "url": "http://naniar.njtierney.com//reference", - "selectors_key": "reference", - "tags": [ - "reference" - ] - }, - { - "url": "http://naniar.njtierney.com//articles", - "selectors_key": "articles", - "tags": [ - "articles" - ] - } - ], - "stop_urls": [ - "/reference/$", - "/reference/index.html", - "/articles/$", - "/articles/index.html" - ], - "sitemap_urls": [ - "http://naniar.njtierney.com//sitemap.xml" - ], - "selectors": { - "homepage": { - "lvl0": { - "selector": ".contents h1", - "default_value": "naniar Home page" - }, - "lvl1": { - "selector": ".contents h2" - }, - "lvl2": { - "selector": ".contents h3", - "default_value": "Context" - }, - "lvl3": ".ref-arguments td, .ref-description", - "text": ".contents p, .contents li, .contents .pre" - }, - "reference": { - "lvl0": { - "selector": ".contents h1" - }, - "lvl1": { - "selector": ".contents .name", - "default_value": "Argument" - }, - "lvl2": { - "selector": ".ref-arguments th", - "default_value": "Description" - }, - "lvl3": ".ref-arguments td, .ref-description", - "text": ".contents p, .contents li" - }, - "articles": { - "lvl0": { - "selector": ".contents h1" - }, - "lvl1": { - "selector": ".contents .name" - }, - "lvl2": { - "selector": ".contents h2, .contents h3", - "default_value": "Context" - }, - "text": ".contents p, .contents li, .tempate-article .contents .pre" - } - }, - "selectors_exclude": [ - ".dont-index" - ], - "min_indexed_level": 2, - "custom_settings": { - "separatorsToIndex": "_", - "attributesToRetrieve": [ - "hierarchy", - "content", - "anchor", - "url", - "url_without_anchor" - ] - } -} - diff --git a/docs/favicon-16x16.png b/docs/favicon-16x16.png deleted file mode 100644 index dfc07453..00000000 Binary files a/docs/favicon-16x16.png and /dev/null differ diff --git a/docs/favicon-32x32.png b/docs/favicon-32x32.png deleted file mode 100644 index 1fee3120..00000000 Binary files a/docs/favicon-32x32.png and /dev/null differ diff --git a/docs/favicon.ico b/docs/favicon.ico deleted file mode 100644 index 78dd14ec..00000000 Binary files a/docs/favicon.ico and /dev/null differ diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 448569c7..00000000 --- a/docs/index.html +++ /dev/null @@ -1,507 +0,0 @@ - - - - - - - - -Data Structures, Summaries, and Visualisations for Missing Data • naniar - - - - - - - - - - - - - - - - - Skip to contents - - -
-
-
- - - -

naniar provides principled, tidy ways to summarise, visualise, and manipulate missing data with minimal deviations from the workflows in ggplot2 and tidy data. It does this by providing:

- -

For more details on the workflow and theory underpinning naniar, read the vignette Getting started with naniar.

-

For a short primer on the data visualisation available in naniar, read the vignette Gallery of Missing Data Visualisations.

-

For full details of the package, including

-
-
-

Installation -

-

You can install naniar from CRAN:

-
-install.packages("naniar")
-

Or you can install the development version on github using remotes:

-
-# install.packages("remotes")
-remotes::install_github("njtierney/naniar")
-
-
-

A short overview of naniar -

-

Visualising missing data might sound a little strange - how do you visualise something that is not there? One approach to visualising missing data comes from ggobi and manet, which replaces NA values with values 10% lower than the minimum value in that variable. This visualisation is provided with the geom_miss_point() ggplot2 geom, which we illustrate by exploring the relationship between Ozone and Solar radiation from the airquality dataset.

-
-
-library(ggplot2)
-
-ggplot(data = airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
-  geom_point()
-#> Warning: Removed 42 rows containing missing values (`geom_point()`).
-

-

ggplot2 does not handle these missing values, and we get a warning message about the missing values.

-

We can instead use geom_miss_point() to display the missing data

-
-
-library(naniar)
-
-ggplot(data = airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
-  geom_miss_point()
-

-

geom_miss_point() has shifted the missing values to now be 10% below the minimum value. The missing values are a different colour so that missingness becomes pre-attentive. As it is a ggplot2 geom, it supports features like faceting and other ggplot features.

-
-
-p1 <-
-ggplot(data = airquality,
-       aes(x = Ozone,
-           y = Solar.R)) + 
-  geom_miss_point() + 
-  facet_wrap(~Month, ncol = 2) + 
-  theme(legend.position = "bottom")
-
-p1
-

-
-
-

Data Structures -

-

naniar provides a data structure for working with missing data, the shadow matrix (Swayne and Buja, 1998). The shadow matrix is the same dimension as the data, and consists of binary indicators of missingness of data values, where missing is represented as “NA”, and not missing is represented as “!NA”, and variable names are kep the same, with the added suffix “_NA” to the variables.

-
-
-head(airquality)
-#>   Ozone Solar.R Wind Temp Month Day
-#> 1    41     190  7.4   67     5   1
-#> 2    36     118  8.0   72     5   2
-#> 3    12     149 12.6   74     5   3
-#> 4    18     313 11.5   62     5   4
-#> 5    NA      NA 14.3   56     5   5
-#> 6    28      NA 14.9   66     5   6
-
-as_shadow(airquality)
-#> # A tibble: 153 × 6
-#>    Ozone_NA Solar.R_NA Wind_NA Temp_NA Month_NA Day_NA
-#>    <fct>    <fct>      <fct>   <fct>   <fct>    <fct> 
-#>  1 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  2 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  3 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  4 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  5 NA       NA         !NA     !NA     !NA      !NA   
-#>  6 !NA      NA         !NA     !NA     !NA      !NA   
-#>  7 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  8 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  9 !NA      !NA        !NA     !NA     !NA      !NA   
-#> 10 NA       !NA        !NA     !NA     !NA      !NA   
-#> # ℹ 143 more rows
-

Binding the shadow data to the data you help keep better track of the missing values. This format is called “nabular”, a portmanteau of NA and tabular. You can bind the shadow to the data using bind_shadow or nabular:

-
-bind_shadow(airquality)
-#> # A tibble: 153 × 12
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA Wind_NA Temp_NA
-#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>      <fct>   <fct>  
-#>  1    41     190   7.4    67     5     1 !NA      !NA        !NA     !NA    
-#>  2    36     118   8      72     5     2 !NA      !NA        !NA     !NA    
-#>  3    12     149  12.6    74     5     3 !NA      !NA        !NA     !NA    
-#>  4    18     313  11.5    62     5     4 !NA      !NA        !NA     !NA    
-#>  5    NA      NA  14.3    56     5     5 NA       NA         !NA     !NA    
-#>  6    28      NA  14.9    66     5     6 !NA      NA         !NA     !NA    
-#>  7    23     299   8.6    65     5     7 !NA      !NA        !NA     !NA    
-#>  8    19      99  13.8    59     5     8 !NA      !NA        !NA     !NA    
-#>  9     8      19  20.1    61     5     9 !NA      !NA        !NA     !NA    
-#> 10    NA     194   8.6    69     5    10 NA       !NA        !NA     !NA    
-#> # ℹ 143 more rows
-#> # ℹ 2 more variables: Month_NA <fct>, Day_NA <fct>
-nabular(airquality)
-#> # A tibble: 153 × 12
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA Wind_NA Temp_NA
-#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>      <fct>   <fct>  
-#>  1    41     190   7.4    67     5     1 !NA      !NA        !NA     !NA    
-#>  2    36     118   8      72     5     2 !NA      !NA        !NA     !NA    
-#>  3    12     149  12.6    74     5     3 !NA      !NA        !NA     !NA    
-#>  4    18     313  11.5    62     5     4 !NA      !NA        !NA     !NA    
-#>  5    NA      NA  14.3    56     5     5 NA       NA         !NA     !NA    
-#>  6    28      NA  14.9    66     5     6 !NA      NA         !NA     !NA    
-#>  7    23     299   8.6    65     5     7 !NA      !NA        !NA     !NA    
-#>  8    19      99  13.8    59     5     8 !NA      !NA        !NA     !NA    
-#>  9     8      19  20.1    61     5     9 !NA      !NA        !NA     !NA    
-#> 10    NA     194   8.6    69     5    10 NA       !NA        !NA     !NA    
-#> # ℹ 143 more rows
-#> # ℹ 2 more variables: Month_NA <fct>, Day_NA <fct>
-

Using the nabular format helps you manage where missing values are in your dataset and make it easy to do visualisations where you split by missingness:

-
-
-airquality %>%
-  bind_shadow() %>%
-  ggplot(aes(x = Temp,
-             fill = Ozone_NA)) + 
-  geom_density(alpha = 0.5)
-

-

And even visualise imputations

-
-
-airquality %>%
-  bind_shadow() %>%
-  as.data.frame() %>% 
-   simputation::impute_lm(Ozone ~ Temp + Solar.R) %>%
-  ggplot(aes(x = Solar.R,
-             y = Ozone,
-             colour = Ozone_NA)) + 
-  geom_point()
-#> Warning: Removed 7 rows containing missing values (`geom_point()`).
-

-

Or perform an upset plot - to plot of the combinations of missingness across cases, using the gg_miss_upset function

-
-
-gg_miss_upset(airquality)
-

-

naniar does this while following consistent principles that are easy to read, thanks to the tools of the tidyverse.

-

naniar also provides handy visualations for each variable:

-
-
-gg_miss_var(airquality)
-

-

Or the number of missings in a given variable at a repeating span

-
-gg_miss_span(pedestrian,
-             var = hourly_counts,
-             span_every = 1500)
-

-

You can read about all of the visualisations in naniar in the vignette Gallery of missing data visualisations using naniar.

-

naniar also provides handy helpers for calculating the number, proportion, and percentage of missing and complete observations:

-
-n_miss(airquality)
-#> [1] 44
-n_complete(airquality)
-#> [1] 874
-prop_miss(airquality)
-#> [1] 0.04793028
-prop_complete(airquality)
-#> [1] 0.9520697
-pct_miss(airquality)
-#> [1] 4.793028
-pct_complete(airquality)
-#> [1] 95.20697
-
-
-

Numerical summaries for missing data -

-

naniar provides numerical summaries of missing data, that follow a consistent rule that uses a syntax begining with miss_. Summaries focussing on variables or a single selected variable, start with miss_var_, and summaries for cases (the initial collected row order of the data), they start with miss_case_. All of these functions that return dataframes also work with dplyr’s group_by().

-

For example, we can look at the number and percent of missings in each case and variable with miss_var_summary(), and miss_case_summary(), which both return output ordered by the number of missing values.

-
-
-miss_var_summary(airquality)
-#> # A tibble: 6 × 3
-#>   variable n_miss pct_miss
-#>   <chr>     <int>    <num>
-#> 1 Ozone        37    24.2 
-#> 2 Solar.R       7     4.58
-#> 3 Wind          0     0   
-#> 4 Temp          0     0   
-#> 5 Month         0     0   
-#> 6 Day           0     0
-miss_case_summary(airquality)
-#> # A tibble: 153 × 3
-#>     case n_miss pct_miss
-#>    <int>  <int>    <dbl>
-#>  1     5      2     33.3
-#>  2    27      2     33.3
-#>  3     6      1     16.7
-#>  4    10      1     16.7
-#>  5    11      1     16.7
-#>  6    25      1     16.7
-#>  7    26      1     16.7
-#>  8    32      1     16.7
-#>  9    33      1     16.7
-#> 10    34      1     16.7
-#> # ℹ 143 more rows
-

You could also group_by() to work out the number of missings in each variable across the levels within it.

-
-
-library(dplyr)
-#> 
-#> Attaching package: 'dplyr'
-#> The following objects are masked from 'package:stats':
-#> 
-#>     filter, lag
-#> The following objects are masked from 'package:base':
-#> 
-#>     intersect, setdiff, setequal, union
-airquality %>%
-  group_by(Month) %>%
-  miss_var_summary()
-#> # A tibble: 25 × 4
-#> # Groups:   Month [5]
-#>    Month variable n_miss pct_miss
-#>    <int> <chr>     <int>    <num>
-#>  1     5 Ozone         5     16.1
-#>  2     5 Solar.R       4     12.9
-#>  3     5 Wind          0      0  
-#>  4     5 Temp          0      0  
-#>  5     5 Day           0      0  
-#>  6     6 Ozone        21     70  
-#>  7     6 Solar.R       0      0  
-#>  8     6 Wind          0      0  
-#>  9     6 Temp          0      0  
-#> 10     6 Day           0      0  
-#> # ℹ 15 more rows
-

You can read more about all of these functions in the vignette “Getting Started with naniar”.

-
-
-

Statistical tests of missingness -

-

naniar provides mcar_test() for Little’s (1988) statistical test for missing completely at random (MCAR) data. The null hypothesis in this test is that the data is MCAR, and the test statistic is a chi-squared value. Given the high statistic value and low p-value, we can conclude that the airquality data is not missing completely at random:

-
-mcar_test(airquality)
-#> # A tibble: 1 × 4
-#>   statistic    df p.value missing.patterns
-#>       <dbl> <dbl>   <dbl>            <int>
-#> 1      35.1    14 0.00142                4
-
-
-

Contributions -

-

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

-
-
-

Future Work -

-
    -
  • Extend the geom_miss_* family to include categorical variables, Bivariate plots: scatterplots, density overlays
  • -
  • SQL translation for databases
  • -
  • Big Data tools (sparklyr, sparklingwater)
  • -
  • Work well with other imputation engines / processes
  • -
  • Provide tools for assessing goodness of fit for classical approaches of MCAR, MAR, and MNAR (graphical inference from nullabor package)
  • -
-
-

Acknowledgements -

-

Firstly, thanks to Di Cook for giving the initial inspiration for the package and laying down the rich theory and literature that the work in naniar is built upon. Naming credit (once again!) goes to Miles McBain. Among various other things, Miles also worked out how to overload the missing data and make it work as a geom. Thanks also to Colin Fay for helping me understand tidy evaluation and for features such as replace_to_na, miss_*_cumsum, and more.

-
-
-

A note on the name -

-

naniar was previously named ggmissing and initially provided a ggplot geom and some other visualisations. ggmissing was changed to naniar to reflect the fact that this package is going to be bigger in scope, and is not just related to ggplot2. Specifically, the package is designed to provide a suite of tools for generating visualisations of missing values and imputations, manipulate, and summarise missing data.

-
-

…But why naniar?

-
-

Well, I think it is useful to think of missing values in data being like this other dimension, perhaps like C.S. Lewis’s Narnia - a different world, hidden away. You go inside, and sometimes it seems like you’ve spent no time in there but time has passed very quickly, or the opposite. Also, NAniar = na in r, and if you so desire, naniar may sound like “noneoya” in an nz/aussie accent. Full credit to @MilesMcbain for the name, and @Hadley for the rearranged spelling.

-
-
- -
-
- - - -
- - - - - - - diff --git a/docs/issue_template.html b/docs/issue_template.html deleted file mode 100644 index edf5108d..00000000 --- a/docs/issue_template.html +++ /dev/null @@ -1,89 +0,0 @@ - -NA • naniar - Skip to contents - - -
-
-
- - -

Hi there!

-

Thanks for filing an issue - it would be really helpful for me if you can include a minimal reproducible example (known as a reprex) if you have a problem you’d like to tell me about. The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it. If you’ve never heard of a reprex before, start by reading https://github.com/jennybc/reprex#what-is-a-reprex, and follow the advice further down the page.

-

Please, Do NOT include session info unless it’s explicitly asked for, or usereprex::reprex(..., si = TRUE) to hide it away.

-

Delete these instructions once you have read them.

-

Brief description of the problem

-
-# insert reprex here
- - -
- - -
- - - - - - - diff --git a/docs/jquery.sticky-kit.min.js b/docs/jquery.sticky-kit.min.js deleted file mode 100644 index 1c162717..00000000 --- a/docs/jquery.sticky-kit.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/* Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | */ -/* - Source: https://github.com/leafo/sticky-kit - License: MIT -*/ -(function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k)); -if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("
"))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q, -u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),eb&&!v&&(c-=l,c=Math.max(b-u,c),c=Math.min(q,c),m&&a.css({top:c+"px"})))):e>F&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+c>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}), -a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);b(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize", -y),b(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,0)}};n=0;for(K=this.length;n - - - - - diff --git a/docs/logo.png b/docs/logo.png deleted file mode 100644 index 8cbb9981..00000000 Binary files a/docs/logo.png and /dev/null differ diff --git a/docs/man/figures/README-facet-by-month-1.png b/docs/man/figures/README-facet-by-month-1.png deleted file mode 100644 index b0f4ec9d..00000000 Binary files a/docs/man/figures/README-facet-by-month-1.png and /dev/null differ diff --git a/docs/man/figures/README-geom-miss-point-1.png b/docs/man/figures/README-geom-miss-point-1.png deleted file mode 100644 index 7a52f5e9..00000000 Binary files a/docs/man/figures/README-geom-miss-point-1.png and /dev/null differ diff --git a/docs/man/figures/README-geom-missing-point-1.png b/docs/man/figures/README-geom-missing-point-1.png deleted file mode 100644 index 29a5576e..00000000 Binary files a/docs/man/figures/README-geom-missing-point-1.png and /dev/null differ diff --git a/docs/man/figures/README-gg-miss-span-1.png b/docs/man/figures/README-gg-miss-span-1.png deleted file mode 100644 index 6bf0c0e7..00000000 Binary files a/docs/man/figures/README-gg-miss-span-1.png and /dev/null differ diff --git a/docs/man/figures/README-gg-miss-var-1.png b/docs/man/figures/README-gg-miss-var-1.png deleted file mode 100644 index 6755c5bf..00000000 Binary files a/docs/man/figures/README-gg-miss-var-1.png and /dev/null differ diff --git a/docs/man/figures/README-gg-missing-var-1.png b/docs/man/figures/README-gg-missing-var-1.png deleted file mode 100644 index b081e9ae..00000000 Binary files a/docs/man/figures/README-gg-missing-var-1.png and /dev/null differ diff --git a/docs/man/figures/README-regular-geom-point-1.png b/docs/man/figures/README-regular-geom-point-1.png deleted file mode 100644 index eba6daaa..00000000 Binary files a/docs/man/figures/README-regular-geom-point-1.png and /dev/null differ diff --git a/docs/man/figures/README-shadow-impute-1.png b/docs/man/figures/README-shadow-impute-1.png deleted file mode 100644 index 69aaf775..00000000 Binary files a/docs/man/figures/README-shadow-impute-1.png and /dev/null differ diff --git a/docs/man/figures/README-shadow-w-ggplot-1.png b/docs/man/figures/README-shadow-w-ggplot-1.png deleted file mode 100644 index 3bf643ad..00000000 Binary files a/docs/man/figures/README-shadow-w-ggplot-1.png and /dev/null differ diff --git a/docs/man/figures/README-unnamed-chunk-3-1.png b/docs/man/figures/README-unnamed-chunk-3-1.png deleted file mode 100644 index bae8d578..00000000 Binary files a/docs/man/figures/README-unnamed-chunk-3-1.png and /dev/null differ diff --git a/docs/man/figures/README-unnamed-chunk-4-1.png b/docs/man/figures/README-unnamed-chunk-4-1.png deleted file mode 100644 index 8709a003..00000000 Binary files a/docs/man/figures/README-unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/man/figures/README-unnamed-chunk-5-1.png b/docs/man/figures/README-unnamed-chunk-5-1.png deleted file mode 100644 index b20503e9..00000000 Binary files a/docs/man/figures/README-unnamed-chunk-5-1.png and /dev/null differ diff --git a/docs/news/index.html b/docs/news/index.html deleted file mode 100644 index b74e2b23..00000000 --- a/docs/news/index.html +++ /dev/null @@ -1,522 +0,0 @@ - -Changelog • naniar - Skip to contents - - -
-
-
- -
-

naniar (development version)

-
-
-

naniar 1.0.0

CRAN release: 2023-02-02

-

Version 1.0.0 of naniar is to signify that this release is associated with the publication of the associated JSS paper, doi:10.18637/jss.v105.i07. There are also a few small changes that have been implemented in this release, which are described below.

-

There is still a lot to do in naniar, and this release does not signify that there are no changes upcoming, more so to establish that this is a stable release, and that any changes upcoming will go through a more formal deprecation process and so on.

-
-

New

-
  • The DOI in the CITATION is for a new JSS publication that will be registered after publication on CRAN.
  • -
  • Replaced tidyr::gather with tidyr::pivot_longer - resolves #301
  • -
  • added set_n_miss and set_prop_miss functions - resolved #298
  • -
-
-

Bug Fixes

-
  • Fix bug in gg_miss_var() where a warning appears to due change in how to remove legend #288.
  • -
-
-

Misc

-
  • Removed gdtools from naniar as no longer needed 302.
  • -
  • added imports, vctrs and cli - which are both free dependencies as they are used within the already used tidyverse already.
  • -
-
-
-

naniar 0.6.1 (2021/05/13) “Incandescent lightbulbs killed the Arc lamps”

CRAN release: 2021-05-14

-
-

New features

-
  • naniar now provides mcar_test() for Little’s (1988) statistical test for missing completely at random (MCAR) data. The null hypothesis in this test is that the data is MCAR, and the test statistic is a chi-squared value. Given a high statistic value and low p-value, we can conclude data are not missing completely at random. Thanks to Andrew Heiss for the PR.
  • -
  • -common_na_strings gains "#N/A".
  • -
-
-

Bug fixes

-
  • Fix bug in miss_var_span() (#270) where the number of missings + number of complete values added up to more than the number of rows in the data. This was due to the remainder not being used when calculating the number of complete values.
  • -
  • Fix bug in recode_shadow() (#272) where adding the same special missing value in two subsequent operations fails.
  • -
-
-
-

naniar 0.6.0 (2020/08/17) “Spur of the lamp post”

CRAN release: 2020-09-02

-
  • Provide warning for replace_with_na when columns provided that don’t exist (see #160). Thank you to michael-dewar for their help with this.
  • -
-

Breaking Changes

-
  • Drop the “nabular” and “shadow” classes (#268) used in nabular() and bind_shadow(). In doing so removes the functions, as_shadow(), is_shadow(), is_nabular(), new_nabular(), new_shadow(). These were mostly used internally and it is not expected that users would have used this functions. If these were used, please file an issue and I can implement them again.
  • -
-
-
-

naniar 0.5.2 (2020/06/28) “Silver Apple”

CRAN release: 2020-06-29

-
-

Minor Changes

-
-
-
-

naniar 0.5.1 (2020/04/10) “Uncle Andrew’s Applewood Wardrobe”

CRAN release: 2020-04-30

-
-

Minor Changes

-
  • Fixes warnings and errors from tibble and subsequent downstream impacts on simputation.
  • -
-
-
-

naniar 0.5.0 (2020/02/20) “The End of this Story and the Beginning of all of the Others”

CRAN release: 2020-02-28

-
-

Breaking Changes

-

Instead use: prop_miss_var(), prop_complete_var(), pct_miss_var(), pct_complete_var(), prop_miss_case(), prop_complete_case(), pct_miss_case(), pct_complete_case(). (see 242)

-
-
-

Minor changes

-
  • -miss_var_cumsum and miss_case_cumsum are now exported
  • -
  • use map_dfc instead of map_df -
  • -
  • Fix various extra warnings and improve test coverage
  • -
-
-

Bug Fixes

-
  • Address bug where the number of missings in a row is not calculated properly - see 238 and 232. The solution involved using rowSums(is.na(x)), which was 3 times faster.
  • -
  • Resolve bug in gg_miss_fct() where warning is given for non explicit NA values - see 241.
  • -
  • skip vdiffr tests on github actions
  • -
  • use tibble() not data_frame() -
  • -
-
-
-

naniar 0.4.2 (2019/02/15) “The Planting of The Tree”

CRAN release: 2019-02-15

-
-

Improvements

-
  • The geom_miss_point() ggplot2 layer can now be converted into an interactive web-based version by the ggplotly() function in the plotly package. In order for this to work, naniar now exports the geom2trace.GeomMissPoint() function (users should never need to call geom2trace.GeomMissPoint() directly – ggplotly() calls it for you).
  • -
  • adds WORDLIST for spelling thanks to usethis::use_spell_check() -
  • -
  • fix documentation @seealso bug (#228) (@sfirke)
  • -
-
-

Dependency fixes

-
  • -

    Thanks to a PR (#223) from @romainfrancois:

    -
    • This fixes two problems that were identified as part of reverse dependency checks of dplyr 0.8.0 release candidate. https://github.com/tidyverse/dplyr/blob/revdep_dplyr_0_8_0_RC/revdep/problems.md#naniar

    • -
    • n() must be imported or prefixed like any other function. In the PR, I’ve changed 1:n() to dplyr::row_number() as naniar seems to prefix all dplyr functions.

    • -
    • update_shadow was only restoring the class attributes, changed so that it restores all attributes, this was causing problems when data was a grouped_df. This likely was a problem before too, but dplyr 0.8.0 is stricter about what is a grouped data frame.

    • -
  • -
-
-
-

naniar 0.4.1 (2018/12/14)

CRAN release: 2018-11-20

-
-

Minor Changes

-
  • pkgdown updates: update favicon and logo, set up for gh-pages deployment
  • -
  • use a scalar integer in new_tibble -
  • -
-
-
-

naniar 0.4.1 (2018/11/20) “Aslan’s Song”

CRAN release: 2018-11-20

-
-

Minor Change

-
-
-
-

naniar 0.4.0 (2018/09/10) “An Unexpected Meeting”

-
-

New Feature

-
  • Add custom label support for missings and not missings with functions add_label_missings and add_label_shadow() and add_any_miss(). So you can now do `add_label_missings(data, missing = “custom_missing_label”, complete = “custom_complete_label”)

  • -
  • impute_median() and scoped variants

  • -
  • any_shade() returns a logical TRUE or FALSE depending on if there are any shade values

  • -
  • nabular() an alias for bind_shadow() to tie the nabular term into the work.

  • -
  • is_nabular() checks if input is nabular.

  • -
  • geom_miss_point() now gains the arguments from shadow_shift()/impute_below() for altering the amount of jitter and proportion below (prop_below).

  • -
  • Added two new vignettes, “Exploring Imputed Values”, and “Special Missing Values”

  • -
  • miss_var_summary and miss_case_summary now no longer provide the cumulative sum of missingness in the summaries - this summary can be added back to the data with the option add_cumsum = TRUE. #186

  • -
  • -

    Added gg_miss_upset to replace workflow of:

    -
    data %>% 
    -  as_shadow_upset() %>%
    -  UpSetR::upset()
    -
  • -
-
-

Major Change

-
  • -recode_shadow now works! This function allows you to recode your missing values into special missing values. These special missing values are stored in the shadow part of the dataframe, which ends in _NA.
  • -
  • implemented shade where appropriate throughout naniar, and also added verifiers, is_shade, are_shade, which_are_shade, and removed which_are_shadow.
  • -
  • -as_shadow and bind_shadow now return data of class shadow. This will feed into recode_shadow methods for flexibly adding new types of missing data.
  • -
  • Note that in the future shadow might be changed to nabble or something similar.
  • -
-
-

Minor feature

-
  • Functions add_label_shadow() and add_label_missings() gain arguments so you can only label according to the missingness / shadowy-ness of given variables.
  • -
  • new function which_are_shadow(), to tell you which values are shadows.
  • -
  • new function long_shadow(), which converts data in shadow/nabular form into a long format suitable for plotting. Related to #165 -
  • -
  • Added tests for miss_scan_count -
  • -
-
-

Minor Changes

-
  • -gg_miss_upset gets a better default presentation by ordering by the largest intersections, and also an improved error message when data with only 1 or no variables have missing values.
  • -
  • -shadow_shift gains a more informative error message when it doesn’t know the class.
  • -
  • Changed common_na_string to include escape characters for “?”, “”, ”.” so that if they are used in replacement or searching functions they don’t return the wildcard results from the characters ”?”, ””, and “.”.
  • -
  • -miss_case_table and miss_var_table now has final column names pct_vars, and pct_cases instead of pct_miss - fixes #178.
  • -
-
-

Breaking Changes

-
  • Deprecated old names of the scalar missingness summaries, in favour of a more consistent syntax #171. The old the and new are:
  • -
- - - - - - - - - - - - - - - - - -
old_namesnew_names
miss_case_pctpct_miss_case
miss_case_propprop_miss_case
miss_var_pctpct_miss_var
miss_var_propprop_miss_var
complete_case_pctpct_complete_case
complete_case_propprop_complete_case
complete_var_pctpct_complete_var
complete_var_propprop_complete_var

These old names will be made defunct in 0.5.0, and removed completely in 0.6.0.

-
  • -impute_below has changed to be an alias of shadow_shift - that is it operates on a single vector. impute_below_all operates on all columns in a dataframe (as specified in #159)
  • -
-
-

Bug fix

-
  • Ensured that miss_scan_count actually return’d something.
  • -
  • -gg_miss_var(airquality) now prints the ggplot - a typo meant that this did not print the plot
  • -
-
-
-

naniar 0.3.1 (2018/06/10) “Strawberry’s Adventure”

CRAN release: 2018-06-08

-
-

Minor Change

-

This is a patch release that removes tidyselect from the package Imports, as it is unnecessary. Fixes #174

-
-
-
-

# naniar 0.3.0 (2018/06/06) “Digory and his Uncle Are Both in Trouble”

CRAN release: 2018-06-07

-
-

New Features

-
  • Added all_miss() / all_na() equivalent to all(is.na(x))

  • -
  • Added any_complete() equivalent to all(complete.cases(x))

  • -
  • Added any_miss() equivalent to anyNA(x)

  • -
  • Added common_na_numbers and finalised common_na_strings - to provide a list of commonly used NA values #168

  • -
  • Added miss_var_which, to lists the variable names with missings

  • -
  • -

    Added as_shadow_upset which gets the data into a format suitable for plotting as an UpSetR plot:

    -
    -
    -airquality %>%
    -  as_shadow_upset() %>%
    -  UpSetR::upset()
    -
  • -
  • -

    Added some imputation functions to assist with exploring missingness structure and visualisation:

    -
    • -impute_below Perfoms as for shadow_shift, but performs on all columns. This means that it imputes missing values 10% below the range of the data (powered by shadow_shift), to facilitate graphical exloration of the data. Closes #145 There are also scoped variants that work for specific named columns: impute_below_at, and for columns that satisfy some predicate function: impute_below_if.
    • -
    • -impute_mean, imputes the mean value, and scoped variants impute_mean_at, and impute_mean_if.
    • -
  • -
  • impute_below and shadow_shift gain arguments prop_below and jitter to control the degree of shift, and also the extent of jitter.

  • -
  • Added complete_{case/var}_{pct/prop}, which complement miss_{var/case}_{pct/prop} #150

  • -
  • Added unbind_shadow and unbind_data as helpers to remove shadow columns from data, and data from shadows, respectively.

  • -
  • Added is_shadow and are_shadow to determine if something contains a shadow column. simimlar to rlang::is_na and rland::are_na, is_shadow this returns a logical vector of length 1, and are_shadow returns a logical vector of length of the number of names of a data.frame. This might be revisited at a later point (see any_shade in add_label_shadow).

  • -
  • Aesthetics now map as expected in geom_miss_point(). This means you can write things like geom_miss_point(aes(colour = Month)) and it works appropriately. Fixed by Luke Smith in Pull request #144, fixing #137.

  • -
-
-

Minor Changes

-
  • miss_var_summary and miss_case_summary now return use order = TRUE by default, so cases and variables with the most missings are presented in descending order. Fixes #163

  • -
  • -

    Changes for Visualisation:

    -
    • Changed the default colours used in gg_miss_case and gg_miss_var to lorikeet purple (from ochRe package: https://github.com/ropenscilabs/ochRe)
    • -
    • -gg_miss_case -
      • The y axis label is now …
      • -
      • Default presentation is with order_cases = TRUE.
      • -
      • Gains a show_pct option to be consistent with gg_miss_var #153 -
      • -
    • -
    • -gg_miss_which is rotated 90 degrees so it is easier to read variable names
    • -
    • -gg_miss_fct uses a minimal theme and tilts the axis labels #118.
    • -
  • -
  • imported is_na and are_na from rlang.

  • -
  • Added common_na_strings, a list of common NA values #168.

  • -
  • Added some detail on alternative methods for replacing with NA in the vignette “replacing values with NA”.

  • -
-
-
-

# naniar 0.2.0 (2018/02/08) (“The First Joke and Other Matters”)

CRAN release: 2018-02-09

-
-

New Features

-
  • Speed improvements. Thanks to the help, contributions, and discussion with Romain François and Jim Hester, naniar now has greatly improved speed for calculating the missingness in each row. These speedups should continue to improve in future releases.

  • -
  • -

    New “scoped variants” of replace_with_na, thankyou to Colin Fay for his work on this:

    -
    • -replace_with_na_all replaces all NAs across the dataframe that meet a specified condition (using the syntax ~.x == -99)
    • -
    • -replace_with_na_at replaces all NAs across for specified variables
    • -
    • -replace_with_na_if replaces all NAs for those variables that satisfy some predicate function (e.g., is.character)
    • -
  • -
  • added which_na - replacement for which(is.na(x))

  • -
  • miss_scan_count. This makes it easier for users to search for particular occurrences of these values across their variables. #119

  • -
  • n_miss_row calculates the number of missing values in each row, returning a vector. There are also 3 other functions which are similar in spirit: n_complete_row, prop_miss_row, and prop_complete_row, which return a vector of the number of complete obserations, the proportion of missings in a row, and the proportion of complete obserations in a row

  • -
  • add_miss_cluster is a new function that calculates a cluster of missingness for each row, using hclust. This can be useful in exploratory modelling of missingness, similar to Tierney et al 2015: “doi: 10.1136/bmjopen-2014-007450” and Barnett et al. 2017: “doi: 10.1136/bmjopen-2017-017284”

  • -
  • Now exported where_na - a function that returns the positions of NA values. For a dataframe it returns a matrix of row and col positions of NAs, and for a vector it returns a vector of positions of NAs. (#105)

  • -
-
-

Minor changes

-
  • Updated the vignette “Gallery of Missing Data Visualisations” to include the facet features and order_cases.
  • -
  • -bind_shadow gains a only_miss argument. When set to FALSE (the default) it will bind a dataframe with all of the variables duplicated with their shadow. Setting this to TRUE will bind variables only those variables that contain missing values.
  • -
  • Cleaned up the visualisation of gg_miss_case to be clearer and less cluttered ( #117), also added n order_cases option to order by cases.
  • -
  • Added a facet argument to gg_miss_var, gg_miss_case, and gg_miss_span. This makes it easier for users to visualise these plots across the values of another variable. In the future I will consider adding facet to the other shorthand plotting function, but at the moment these seemed to be the ones that would benefit the most from this feature.
  • -
-
-

Bug fix

-
  • -oceanbuoys now is numeric type for year, latitude, and longitude, previously it was factor. See related issue -
  • -
  • Improved handling of shadow_shift when there are Inf or -Inf values (see #117)
  • -
-
-

Breaking change

-
  • Deprecated replace_to_na, with replace_with_na, as it is a more natural phrase (“replace coffee to tea” vs “replace coffee with tea”). This will be made defunct in the next version.

  • -
  • cast_shadow no longer works when called as cast_shadow(data). This action used to return all variables, and then shadow variables for the variables that only contained missing values. This was inconsistent with the use of cast_shadow(data, var1, var2). A new option has been added to bind_shadow that controls this - discussed below. See more details at issue 65.

  • -
  • Change behaviour of cast_shadow so that the default option is to return only the variables that contain missings. This is different to bind_shadow, which binds a complete shadow matrix to the dataframe. A way to think about this is that the shadow is only cast on variables that contain missing values, whereas a bind is binding a complete shadow to the data. This may change in the future to be the default option for bind_shadow.

  • -
-
-

Minor Changes

-
  • Update vignettes to have floating menu and better figure size.
  • -
  • minor changes to graphics in gg_miss_fct - change legend title from “Percent Missing” to “% Miss”.
  • -
-
-
-

# naniar 0.1.0 (2017/08/09) “The Founding of naniar

CRAN release: 2017-08-09

-
  • This is the first release of naniar onto CRAN, updates to naniar will happen reasonably regularly after this approximately every 1-2 months
  • -
-
-

# naniar 0.0.9.9995 (2017/08/07)

-
-

Name change

-
  • After careful consideration, I have changed back to naniar -
  • -
-
-

Major Change

-
  • three new functions : miss_case_cumsum / miss_var_cumsum / replace_to_na -
  • -
  • two new visualisations : gg_var_cumsum & gg_case_cumsum -
  • -
- -
-

Minor changes

-
  • Reviewed documentation for all functions and improved wording, grammar, and style.
  • -
  • Converted roxygen to roxygen markdown
  • -
  • updated vignettes and readme
  • -
  • added a new vignette “naniar-visualisation”, to give a quick overview of the visualisations provided with naniar.
  • -
  • changed label_missing* to label_miss to be more consistent with the rest of naniar
  • -
  • Add pct and prop helpers (#78)
  • -
  • removed miss_df_pct - this was literally the same as pct_miss or prop_miss.
  • -
  • break larger files into smaller, more manageable files (#83)
  • -
  • -gg_miss_var gets a show_pct argument to show the percentage of missing values (Thanks Jennifer for the helpful feedback! :))
  • -
-
-

Minor changes

-
  • -miss_var_summary & miss_case_summary now have consistent output (one was ordered by n_missing, not the other).
  • -
  • prevent error in miss_case_pct -
  • -
  • -enquo_x is now x -
  • -
  • Now has ByteCompile to TRUE
  • -
  • add Colin to auth
  • -
-
-
-

# naniar 0.0.6.9100 (2017/03/21)

-
  • Added prop_miss and the complement prop_complete. Where n_miss returns the number of missing values, prop_miss returns the proportion of missing values. Likewise, prop_complete returns the proportion of complete values.
  • -
-

Defunct functions

-
  • As stated in 0.0.5.9000, to address Issue #38, I am moving towards the format miss_type_value/fun, because it makes more sense to me when tabbing through functions.
  • -

The left hand side functions have been made defunct in favour of the right hand side. - percent_missing_case() –> miss_case_pct() - percent_missing_var() –> miss_var_pct() - percent_missing_df() –> miss_df_pct() - summary_missing_case() –> miss_case_summary() - summary_missing_var() –> miss_var_summary() - table_missing_case() –> miss_case_table() - table_missing_var() –> miss_var_table()

-
-
-
-

# naniar 0.0.5.9000 (2016/01/08)

-
-

Deprecated functions

-
  • To address Issue #38, I am moving towards the format miss_type_value/fun, because it makes more sense to me when tabbing through functions.
  • -
  • -miss_* = I want to explore missing values
  • -
  • -miss_case_* = I want to explore missing cases
  • -
  • -miss_case_pct = I want to find the percentage of cases containing a missing value
  • -
  • -miss_case_summary = I want to find the number / percentage of missings in each case
  • -
  • -miss_case_table = I want a tabulation of the number / percentage of cases missing
  • -

This is more consistent and easier to reason with.

-

Thus, I have renamed the following functions: - percent_missing_case() –> miss_case_pct() - percent_missing_var() –> miss_var_pct() - percent_missing_df() –> miss_df_pct() - summary_missing_case() –> miss_case_summary() - summary_missing_var() –> miss_var_summary() - table_missing_case() –> miss_case_table() - table_missing_var() –> miss_var_table()

-

These will be made defunct in the next release, 0.0.6.9000 (“The Wood Between Worlds”).

-
-
-
-

# naniar 0.0.4.9000 (2016/12/31)

-
-

New features

-
  • -n_complete is a complement to n_miss, and counts the number of complete values in a vector, matrix, or dataframe.
  • -
-
-

Bug fixes

-
  • -shadow_shift now handles cases where there is only 1 complete value in a vector.
  • -
-
-

Other changes

-
  • added much more comprehensive testing with testthat.
  • -
-
-
-

# naniar 0.0.3.9901 (2016/12/18)

-

After a burst of effort on this package I have done some refactoring and thought hard about where this package is going to go. This meant that I had to make the decision to rename the package from ggmissing to naniar. The name may strike you as strange but it reflects the fact that there are many changes happening, and that we will be working on creating a nice utopia (like Narnia by CS Lewis) that helps us make it easier to work with missing data

-
-

New Features (under development)

-
  • add_n_miss and add_prop_miss are helpers that add columns to a dataframe containing the number and proportion of missing values. An example has been provided to use decision trees to explore missing data structure as in “doi: 10.1136/bmjopen-2014-007450”

  • -
  • geom_miss_point() now supports transparency, thanks to @seasmith (Luke Smith)

  • -
  • more shadows. These are mainly around bind_shadow and gather_shadow, which are helper functions to assist with creating

  • -
-
-

Bug fixes

-
  • geom_missing_point() broke after the new release of ggplot2 2.2.0, but this is now fixed by ensuring that it inherits from GeomPoint, rather than just a new Geom. Thanks to Mitchell O’hara-Wild for his help with this.

  • -
  • missing data summaries table_missing_var and table_missing_case also now return more sensible numbers and variable names. It is possible these function names will change in the future, as these are kind of verbose.

  • -
  • semantic versioning was incorrectly entered in the DESCRIPTION file as 0.2.9000, so I changed it to 0.0.2.9000, and then to 0.0.3.9000 now to indicate the new changes, hopefully this won’t come back to bite me later. I think I accidentally did this with visdat at some point as well. Live and learn.

  • -
-
-

Other changes

-
  • gathered related functions into single R files rather than leaving them in their own.

  • -
  • correctly imported the %>% operator from magrittr, and removed a lot of chaff around @importFrom - really don’t need to use @importFrom that often.

  • -
-
-
- - -
- - - - - - - diff --git a/docs/pkgdown.css b/docs/pkgdown.css deleted file mode 100644 index 80ea5b83..00000000 --- a/docs/pkgdown.css +++ /dev/null @@ -1,384 +0,0 @@ -/* Sticky footer */ - -/** - * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ - * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css - * - * .Site -> body > .container - * .Site-content -> body > .container .row - * .footer -> footer - * - * Key idea seems to be to ensure that .container and __all its parents__ - * have height set to 100% - * - */ - -html, body { - height: 100%; -} - -body { - position: relative; -} - -body > .container { - display: flex; - height: 100%; - flex-direction: column; -} - -body > .container .row { - flex: 1 0 auto; -} - -footer { - margin-top: 45px; - padding: 35px 0 36px; - border-top: 1px solid #e5e5e5; - color: #666; - display: flex; - flex-shrink: 0; -} -footer p { - margin-bottom: 0; -} -footer div { - flex: 1; -} -footer .pkgdown { - text-align: right; -} -footer p { - margin-bottom: 0; -} - -img.icon { - float: right; -} - -/* Ensure in-page images don't run outside their container */ -.contents img { - max-width: 100%; - height: auto; -} - -/* Fix bug in bootstrap (only seen in firefox) */ -summary { - display: list-item; -} - -/* Typographic tweaking ---------------------------------*/ - -.contents .page-header { - margin-top: calc(-60px + 1em); -} - -dd { - margin-left: 3em; -} - -/* Section anchors ---------------------------------*/ - -a.anchor { - display: none; - margin-left: 5px; - width: 20px; - height: 20px; - - background-image: url(./link.svg); - background-repeat: no-repeat; - background-size: 20px 20px; - background-position: center center; -} - -h1:hover .anchor, -h2:hover .anchor, -h3:hover .anchor, -h4:hover .anchor, -h5:hover .anchor, -h6:hover .anchor { - display: inline-block; -} - -/* Fixes for fixed navbar --------------------------*/ - -.contents h1, .contents h2, .contents h3, .contents h4 { - padding-top: 60px; - margin-top: -40px; -} - -/* Navbar submenu --------------------------*/ - -.dropdown-submenu { - position: relative; -} - -.dropdown-submenu>.dropdown-menu { - top: 0; - left: 100%; - margin-top: -6px; - margin-left: -1px; - border-radius: 0 6px 6px 6px; -} - -.dropdown-submenu:hover>.dropdown-menu { - display: block; -} - -.dropdown-submenu>a:after { - display: block; - content: " "; - float: right; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - border-width: 5px 0 5px 5px; - border-left-color: #cccccc; - margin-top: 5px; - margin-right: -10px; -} - -.dropdown-submenu:hover>a:after { - border-left-color: #ffffff; -} - -.dropdown-submenu.pull-left { - float: none; -} - -.dropdown-submenu.pull-left>.dropdown-menu { - left: -100%; - margin-left: 10px; - border-radius: 6px 0 6px 6px; -} - -/* Sidebar --------------------------*/ - -#pkgdown-sidebar { - margin-top: 30px; - position: -webkit-sticky; - position: sticky; - top: 70px; -} - -#pkgdown-sidebar h2 { - font-size: 1.5em; - margin-top: 1em; -} - -#pkgdown-sidebar h2:first-child { - margin-top: 0; -} - -#pkgdown-sidebar .list-unstyled li { - margin-bottom: 0.5em; -} - -/* bootstrap-toc tweaks ------------------------------------------------------*/ - -/* All levels of nav */ - -nav[data-toggle='toc'] .nav > li > a { - padding: 4px 20px 4px 6px; - font-size: 1.5rem; - font-weight: 400; - color: inherit; -} - -nav[data-toggle='toc'] .nav > li > a:hover, -nav[data-toggle='toc'] .nav > li > a:focus { - padding-left: 5px; - color: inherit; - border-left: 1px solid #878787; -} - -nav[data-toggle='toc'] .nav > .active > a, -nav[data-toggle='toc'] .nav > .active:hover > a, -nav[data-toggle='toc'] .nav > .active:focus > a { - padding-left: 5px; - font-size: 1.5rem; - font-weight: 400; - color: inherit; - border-left: 2px solid #878787; -} - -/* Nav: second level (shown on .active) */ - -nav[data-toggle='toc'] .nav .nav { - display: none; /* Hide by default, but at >768px, show it */ - padding-bottom: 10px; -} - -nav[data-toggle='toc'] .nav .nav > li > a { - padding-left: 16px; - font-size: 1.35rem; -} - -nav[data-toggle='toc'] .nav .nav > li > a:hover, -nav[data-toggle='toc'] .nav .nav > li > a:focus { - padding-left: 15px; -} - -nav[data-toggle='toc'] .nav .nav > .active > a, -nav[data-toggle='toc'] .nav .nav > .active:hover > a, -nav[data-toggle='toc'] .nav .nav > .active:focus > a { - padding-left: 15px; - font-weight: 500; - font-size: 1.35rem; -} - -/* orcid ------------------------------------------------------------------- */ - -.orcid { - font-size: 16px; - color: #A6CE39; - /* margins are required by official ORCID trademark and display guidelines */ - margin-left:4px; - margin-right:4px; - vertical-align: middle; -} - -/* Reference index & topics ----------------------------------------------- */ - -.ref-index th {font-weight: normal;} - -.ref-index td {vertical-align: top; min-width: 100px} -.ref-index .icon {width: 40px;} -.ref-index .alias {width: 40%;} -.ref-index-icons .alias {width: calc(40% - 40px);} -.ref-index .title {width: 60%;} - -.ref-arguments th {text-align: right; padding-right: 10px;} -.ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} -.ref-arguments .name {width: 20%;} -.ref-arguments .desc {width: 80%;} - -/* Nice scrolling for wide elements --------------------------------------- */ - -table { - display: block; - overflow: auto; -} - -/* Syntax highlighting ---------------------------------------------------- */ - -pre, code, pre code { - background-color: #f8f8f8; - color: #333; -} -pre, pre code { - white-space: pre-wrap; - word-break: break-all; - overflow-wrap: break-word; -} - -pre { - border: 1px solid #eee; -} - -pre .img, pre .r-plt { - margin: 5px 0; -} - -pre .img img, pre .r-plt img { - background-color: #fff; -} - -code a, pre a { - color: #375f84; -} - -a.sourceLine:hover { - text-decoration: none; -} - -.fl {color: #1514b5;} -.fu {color: #000000;} /* function */ -.ch,.st {color: #036a07;} /* string */ -.kw {color: #264D66;} /* keyword */ -.co {color: #888888;} /* comment */ - -.error {font-weight: bolder;} -.warning {font-weight: bolder;} - -/* Clipboard --------------------------*/ - -.hasCopyButton { - position: relative; -} - -.btn-copy-ex { - position: absolute; - right: 0; - top: 0; - visibility: hidden; -} - -.hasCopyButton:hover button.btn-copy-ex { - visibility: visible; -} - -/* headroom.js ------------------------ */ - -.headroom { - will-change: transform; - transition: transform 200ms linear; -} -.headroom--pinned { - transform: translateY(0%); -} -.headroom--unpinned { - transform: translateY(-100%); -} - -/* mark.js ----------------------------*/ - -mark { - background-color: rgba(255, 255, 51, 0.5); - border-bottom: 2px solid rgba(255, 153, 51, 0.3); - padding: 1px; -} - -/* vertical spacing after htmlwidgets */ -.html-widget { - margin-bottom: 10px; -} - -/* fontawesome ------------------------ */ - -.fab { - font-family: "Font Awesome 5 Brands" !important; -} - -/* don't display links in code chunks when printing */ -/* source: https://stackoverflow.com/a/10781533 */ -@media print { - code a:link:after, code a:visited:after { - content: ""; - } -} - -/* Section anchors --------------------------------- - Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 -*/ - -div.csl-bib-body { } -div.csl-entry { - clear: both; -} -.hanging-indent div.csl-entry { - margin-left:2em; - text-indent:-2em; -} -div.csl-left-margin { - min-width:2em; - float:left; -} -div.csl-right-inline { - margin-left:2em; - padding-left:1em; -} -div.csl-indent { - margin-left: 2em; -} diff --git a/docs/pkgdown.js b/docs/pkgdown.js deleted file mode 100644 index 5fccd9c0..00000000 --- a/docs/pkgdown.js +++ /dev/null @@ -1,156 +0,0 @@ -/* http://gregfranko.com/blog/jquery-best-practices/ */ -(function($) { - $(function() { - - $('nav.navbar').headroom(); - - Toc.init({ - $nav: $("#toc"), - $scope: $("main h2, main h3, main h4, main h5, main h6") - }); - - if ($('#toc').length) { - $('body').scrollspy({ - target: '#toc', - offset: $("nav.navbar").outerHeight() + 1 - }); - } - - // Activate popovers - $('[data-bs-toggle="popover"]').popover({ - container: 'body', - html: true, - trigger: 'focus', - placement: "top", - sanitize: false, - }); - - $('[data-bs-toggle="tooltip"]').tooltip(); - - /* Clipboard --------------------------*/ - - function changeTooltipMessage(element, msg) { - var tooltipOriginalTitle=element.getAttribute('data-original-title'); - element.setAttribute('data-original-title', msg); - $(element).tooltip('show'); - element.setAttribute('data-original-title', tooltipOriginalTitle); - } - - if(ClipboardJS.isSupported()) { - $(document).ready(function() { - var copyButton = ""; - - $("div.sourceCode").addClass("hasCopyButton"); - - // Insert copy buttons: - $(copyButton).prependTo(".hasCopyButton"); - - // Initialize tooltips: - $('.btn-copy-ex').tooltip({container: 'body'}); - - // Initialize clipboard: - var clipboard = new ClipboardJS('[data-clipboard-copy]', { - text: function(trigger) { - return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); - } - }); - - clipboard.on('success', function(e) { - changeTooltipMessage(e.trigger, 'Copied!'); - e.clearSelection(); - }); - - clipboard.on('error', function() { - changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); - }); - - }); - } - - /* Search marking --------------------------*/ - var url = new URL(window.location.href); - var toMark = url.searchParams.get("q"); - var mark = new Mark("main#main"); - if (toMark) { - mark.mark(toMark, { - accuracy: { - value: "complementary", - limiters: [",", ".", ":", "/"], - } - }); - } - - /* Search --------------------------*/ - /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ - // Initialise search index on focus - var fuse; - $("#search-input").focus(async function(e) { - if (fuse) { - return; - } - - $(e.target).addClass("loading"); - var response = await fetch($("#search-input").data("search-index")); - var data = await response.json(); - - var options = { - keys: ["what", "text", "code"], - ignoreLocation: true, - threshold: 0.1, - includeMatches: true, - includeScore: true, - }; - fuse = new Fuse(data, options); - - $(e.target).removeClass("loading"); - }); - - // Use algolia autocomplete - var options = { - autoselect: true, - debug: true, - hint: false, - minLength: 2, - }; - var q; -async function searchFuse(query, callback) { - await fuse; - - var items; - if (!fuse) { - items = []; - } else { - q = query; - var results = fuse.search(query, { limit: 20 }); - items = results - .filter((x) => x.score <= 0.75) - .map((x) => x.item); - if (items.length === 0) { - items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}]; - } - } - callback(items); -} - $("#search-input").autocomplete(options, [ - { - name: "content", - source: searchFuse, - templates: { - suggestion: (s) => { - if (s.title == s.what) { - return `${s.dir} >
${s.title}
`; - } else if (s.previous_headings == "") { - return `${s.dir} >
${s.title}
> ${s.what}`; - } else { - return `${s.dir} >
${s.title}
> ${s.previous_headings} > ${s.what}`; - } - }, - }, - }, - ]).on('autocomplete:selected', function(event, s) { - window.location.href = s.path + "?q=" + q + "#" + s.id; - }); - }); -})(window.jQuery || window.$) - - diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml deleted file mode 100644 index 6adfad70..00000000 --- a/docs/pkgdown.yml +++ /dev/null @@ -1,14 +0,0 @@ -pandoc: 2.19.2 -pkgdown: 2.0.7 -pkgdown_sha: ~ -articles: - exploring-imputed-values: exploring-imputed-values.html - getting-started-w-naniar: getting-started-w-naniar.html - naniar-visualisation: naniar-visualisation.html - replace-with-na: replace-with-na.html - special-missing-values: special-missing-values.html -last_built: 2023-05-01T23:09Z -urls: - reference: http://naniar.njtierney.com/reference - article: http://naniar.njtierney.com/articles - diff --git a/docs/pull_request_template.html b/docs/pull_request_template.html deleted file mode 100644 index 28a96ce1..00000000 --- a/docs/pull_request_template.html +++ /dev/null @@ -1,107 +0,0 @@ - -NA • naniar - Skip to contents - - -
-
-
- - -
-

Description

- -
-
- - -
-
-

Example

- -
-
-

Tests

- -
-
-

NEWS + DESCRIPTION

- -
- - -
- - -
- - - - - - - diff --git a/docs/reference/add_any_miss.html b/docs/reference/add_any_miss.html deleted file mode 100644 index dab951e5..00000000 --- a/docs/reference/add_any_miss.html +++ /dev/null @@ -1,197 +0,0 @@ - -Add a column describing presence of any missing values — add_any_miss • naniar - Skip to contents - - -
-
-
- -
-

This adds a column named "any_miss" (by default) that describes whether -there are any missings in all of the variables (default), or whether any -of the specified columns, specified using variables names or dplyr verbs, -starts_with, contains, ends_with, etc. By default the added column -will be called "any_miss_all", if no variables are specified, otherwise, -if variables are specified, the label will be "any_miss_vars" to indicate -that not all variables have been used to create the labels.

-
- -
-

Usage

-
add_any_miss(
-  data,
-  ...,
-  label = "any_miss",
-  missing = "missing",
-  complete = "complete"
-)
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

Variable names to use instead of the whole dataset. By default this -looks at the whole dataset. Otherwise, this is one or more unquoted -expressions separated by commas. These also respect the dplyr verbs -starts_with, contains, ends_with, etc. By default will add "_all" to -the label if left blank, otherwise will add "_vars" to distinguish that it -has not been used on all of the variables.

- - -
label
-

label for the column, defaults to "any_miss". By default if no -additional variables are listed the label col is "any_miss_all", otherwise -it is "any_miss_vars", if variables are specified.

- - -
missing
-

character a label for when values are missing - defaults to "missing"

- - -
complete
-

character character a label for when values are complete - defaults to "complete"

- -
-
-

Value

- - -

data.frame with data and the column labelling whether that row (for -those variables) has any missing values - indicated by "missing" and -"complete".

-
-
-

Details

-

By default the -prefix "any_miss" is used, but this can be changed in the label argument.

-
- - -
-

Examples

-

-airquality %>% add_any_miss()
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day any_miss_all
-#>    <int>   <int> <dbl> <int> <int> <int> <chr>       
-#>  1    41     190   7.4    67     5     1 complete    
-#>  2    36     118   8      72     5     2 complete    
-#>  3    12     149  12.6    74     5     3 complete    
-#>  4    18     313  11.5    62     5     4 complete    
-#>  5    NA      NA  14.3    56     5     5 missing     
-#>  6    28      NA  14.9    66     5     6 missing     
-#>  7    23     299   8.6    65     5     7 complete    
-#>  8    19      99  13.8    59     5     8 complete    
-#>  9     8      19  20.1    61     5     9 complete    
-#> 10    NA     194   8.6    69     5    10 missing     
-#> # ℹ 143 more rows
-airquality %>% add_any_miss(Ozone, Solar.R)
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day any_miss_vars
-#>    <int>   <int> <dbl> <int> <int> <int> <chr>        
-#>  1    41     190   7.4    67     5     1 complete     
-#>  2    36     118   8      72     5     2 complete     
-#>  3    12     149  12.6    74     5     3 complete     
-#>  4    18     313  11.5    62     5     4 complete     
-#>  5    NA      NA  14.3    56     5     5 missing      
-#>  6    28      NA  14.9    66     5     6 missing      
-#>  7    23     299   8.6    65     5     7 complete     
-#>  8    19      99  13.8    59     5     8 complete     
-#>  9     8      19  20.1    61     5     9 complete     
-#> 10    NA     194   8.6    69     5    10 missing      
-#> # ℹ 143 more rows
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/add_label_missings.html b/docs/reference/add_label_missings.html deleted file mode 100644 index 94f77ccd..00000000 --- a/docs/reference/add_label_missings.html +++ /dev/null @@ -1,171 +0,0 @@ - -Add a column describing if there are any missings in the dataset — add_label_missings • naniar - Skip to contents - - -
-
-
- -
-

Add a column describing if there are any missings in the dataset

-
- -
-

Usage

-
add_label_missings(data, ..., missing = "Missing", complete = "Not Missing")
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

extra variable to label

- - -
missing
-

character a label for when values are missing - defaults to "Missing"

- - -
complete
-

character character a label for when values are complete - defaults to "Not Missing"

- -
-
-

Value

- - -

data.frame with a column "any_missing" that is either "Not Missing" -or "Missing" for the purposes of plotting / exploration / nice print methods

-
- - -
-

Examples

-

-airquality %>% add_label_missings()
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day any_missing
-#>    <int>   <int> <dbl> <int> <int> <int> <chr>      
-#>  1    41     190   7.4    67     5     1 Not Missing
-#>  2    36     118   8      72     5     2 Not Missing
-#>  3    12     149  12.6    74     5     3 Not Missing
-#>  4    18     313  11.5    62     5     4 Not Missing
-#>  5    NA      NA  14.3    56     5     5 Missing    
-#>  6    28      NA  14.9    66     5     6 Missing    
-#>  7    23     299   8.6    65     5     7 Not Missing
-#>  8    19      99  13.8    59     5     8 Not Missing
-#>  9     8      19  20.1    61     5     9 Not Missing
-#> 10    NA     194   8.6    69     5    10 Missing    
-#> # ℹ 143 more rows
-airquality %>% add_label_missings(Ozone, Solar.R)
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day any_missing
-#>    <int>   <int> <dbl> <int> <int> <int> <chr>      
-#>  1    41     190   7.4    67     5     1 Not Missing
-#>  2    36     118   8      72     5     2 Not Missing
-#>  3    12     149  12.6    74     5     3 Not Missing
-#>  4    18     313  11.5    62     5     4 Not Missing
-#>  5    NA      NA  14.3    56     5     5 Missing    
-#>  6    28      NA  14.9    66     5     6 Missing    
-#>  7    23     299   8.6    65     5     7 Not Missing
-#>  8    19      99  13.8    59     5     8 Not Missing
-#>  9     8      19  20.1    61     5     9 Not Missing
-#> 10    NA     194   8.6    69     5    10 Missing    
-#> # ℹ 143 more rows
-airquality %>% add_label_missings(Ozone, Solar.R, missing = "yes", complete = "no")
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day any_missing
-#>    <int>   <int> <dbl> <int> <int> <int> <chr>      
-#>  1    41     190   7.4    67     5     1 no         
-#>  2    36     118   8      72     5     2 no         
-#>  3    12     149  12.6    74     5     3 no         
-#>  4    18     313  11.5    62     5     4 no         
-#>  5    NA      NA  14.3    56     5     5 yes        
-#>  6    28      NA  14.9    66     5     6 yes        
-#>  7    23     299   8.6    65     5     7 no         
-#>  8    19      99  13.8    59     5     8 no         
-#>  9     8      19  20.1    61     5     9 no         
-#> 10    NA     194   8.6    69     5    10 yes        
-#> # ℹ 143 more rows
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/add_label_shadow.html b/docs/reference/add_label_shadow.html deleted file mode 100644 index ea155505..00000000 --- a/docs/reference/add_label_shadow.html +++ /dev/null @@ -1,152 +0,0 @@ - -Add a column describing whether there is a shadow — add_label_shadow • naniar - Skip to contents - - -
-
-
- -
-

Instead of focussing on labelling whether there are missings, we instead -focus on whether there have been any shadows created. This can be useful -when data has been imputed and you need to determine which rows contained -missing values when the shadow was bound to the dataset.

-
- -
-

Usage

-
add_label_shadow(data, ..., missing = "Missing", complete = "Not Missing")
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

extra variable to label

- - -
missing
-

character a label for when values are missing - defaults to "Missing"

- - -
complete
-

character character a label for when values are complete - defaults to "Not Missing"

- -
-
-

Value

- - -

data.frame with a column, "any_missing", which describes whether or -not there are any rows that have a shadow value.

-
- - -
-

Examples

-

-airquality %>%
-  add_shadow(Ozone, Solar.R) %>%
-  add_label_shadow()
-#> # A tibble: 153 × 9
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA any_missing
-#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>      <chr>      
-#>  1    41     190   7.4    67     5     1 !NA      !NA        Not Missing
-#>  2    36     118   8      72     5     2 !NA      !NA        Not Missing
-#>  3    12     149  12.6    74     5     3 !NA      !NA        Not Missing
-#>  4    18     313  11.5    62     5     4 !NA      !NA        Not Missing
-#>  5    NA      NA  14.3    56     5     5 NA       NA         Missing    
-#>  6    28      NA  14.9    66     5     6 !NA      NA         Missing    
-#>  7    23     299   8.6    65     5     7 !NA      !NA        Not Missing
-#>  8    19      99  13.8    59     5     8 !NA      !NA        Not Missing
-#>  9     8      19  20.1    61     5     9 !NA      !NA        Not Missing
-#> 10    NA     194   8.6    69     5    10 NA       !NA        Missing    
-#> # ℹ 143 more rows
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/add_miss_cluster.html b/docs/reference/add_miss_cluster.html deleted file mode 100644 index cddaa27c..00000000 --- a/docs/reference/add_miss_cluster.html +++ /dev/null @@ -1,175 +0,0 @@ - -Add a column that tells us which "missingness cluster" a row belongs to — add_miss_cluster • naniar - Skip to contents - - -
-
-
- -
-

A way to extract the cluster of missingness that a group belongs to. -For example, if you use vis_miss(airquality, cluster = TRUE), you can -see some clustering in the data, but you do not have a way to identify -the cluster. Future work will incorporate the seriation package to -allow for better control over the clustering from the user.

-
- -
-

Usage

-
add_miss_cluster(data, cluster_method = "mcquitty", n_clusters = 2)
-
- -
-

Arguments

-
data
-

a dataframe

- - -
cluster_method
-

character vector of the agglomeration method to use, -the default is "mcquitty". Options are taken from stats::hclust -helpfile, and options include: "ward.D", "ward.D2", "single", "complete", -"average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or -"centroid" (= UPGMC).

- - -
n_clusters
-

numeric the number of clusters you expect. Defaults to 2.

- -
- - -
-

Examples

-

-add_miss_cluster(airquality)
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day miss_cluster
-#>    <int>   <int> <dbl> <int> <int> <int>        <int>
-#>  1    41     190   7.4    67     5     1            1
-#>  2    36     118   8      72     5     2            1
-#>  3    12     149  12.6    74     5     3            1
-#>  4    18     313  11.5    62     5     4            1
-#>  5    NA      NA  14.3    56     5     5            2
-#>  6    28      NA  14.9    66     5     6            1
-#>  7    23     299   8.6    65     5     7            1
-#>  8    19      99  13.8    59     5     8            1
-#>  9     8      19  20.1    61     5     9            1
-#> 10    NA     194   8.6    69     5    10            2
-#> # ℹ 143 more rows
-add_miss_cluster(airquality, n_clusters = 3)
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day miss_cluster
-#>    <int>   <int> <dbl> <int> <int> <int>        <int>
-#>  1    41     190   7.4    67     5     1            1
-#>  2    36     118   8      72     5     2            1
-#>  3    12     149  12.6    74     5     3            1
-#>  4    18     313  11.5    62     5     4            1
-#>  5    NA      NA  14.3    56     5     5            2
-#>  6    28      NA  14.9    66     5     6            1
-#>  7    23     299   8.6    65     5     7            1
-#>  8    19      99  13.8    59     5     8            1
-#>  9     8      19  20.1    61     5     9            1
-#> 10    NA     194   8.6    69     5    10            3
-#> # ℹ 143 more rows
-add_miss_cluster(airquality, cluster_method = "ward.D", n_clusters = 3)
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day miss_cluster
-#>    <int>   <int> <dbl> <int> <int> <int>        <int>
-#>  1    41     190   7.4    67     5     1            1
-#>  2    36     118   8      72     5     2            1
-#>  3    12     149  12.6    74     5     3            1
-#>  4    18     313  11.5    62     5     4            1
-#>  5    NA      NA  14.3    56     5     5            2
-#>  6    28      NA  14.9    66     5     6            2
-#>  7    23     299   8.6    65     5     7            1
-#>  8    19      99  13.8    59     5     8            1
-#>  9     8      19  20.1    61     5     9            1
-#> 10    NA     194   8.6    69     5    10            3
-#> # ℹ 143 more rows
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/add_n_miss.html b/docs/reference/add_n_miss.html deleted file mode 100644 index e40e91ac..00000000 --- a/docs/reference/add_n_miss.html +++ /dev/null @@ -1,598 +0,0 @@ - -Add column containing number of missing data values — add_n_miss • naniar - Skip to contents - - -
-
-
- -
-

It can be useful when doing data analysis to add the number of missing data -points into your dataframe. add_n_miss adds a column named "n_miss", -which contains the number of missing values in that row.

-
- -
-

Usage

-
add_n_miss(data, ..., label = "n_miss")
-
- -
-

Arguments

-
data
-

a dataframe

- - -
...
-

Variable names to use instead of the whole dataset. By default this -looks at the whole dataset. Otherwise, this is one or more unquoted -expressions separated by commas. These also respect the dplyr verbs -starts_with, contains, ends_with, etc. By default will add "_all" to -the label if left blank, otherwise will add "_vars" to distinguish that it -has not been used on all of the variables.

- - -
label
-

character default is "n_miss".

- -
-
-

Value

- - -

a dataframe

-
- - -
-

Examples

-

-airquality %>% add_n_miss()
-#>     Ozone Solar.R Wind Temp Month Day n_miss_all
-#> 1      41     190  7.4   67     5   1          0
-#> 2      36     118  8.0   72     5   2          0
-#> 3      12     149 12.6   74     5   3          0
-#> 4      18     313 11.5   62     5   4          0
-#> 5      NA      NA 14.3   56     5   5          2
-#> 6      28      NA 14.9   66     5   6          1
-#> 7      23     299  8.6   65     5   7          0
-#> 8      19      99 13.8   59     5   8          0
-#> 9       8      19 20.1   61     5   9          0
-#> 10     NA     194  8.6   69     5  10          1
-#> 11      7      NA  6.9   74     5  11          1
-#> 12     16     256  9.7   69     5  12          0
-#> 13     11     290  9.2   66     5  13          0
-#> 14     14     274 10.9   68     5  14          0
-#> 15     18      65 13.2   58     5  15          0
-#> 16     14     334 11.5   64     5  16          0
-#> 17     34     307 12.0   66     5  17          0
-#> 18      6      78 18.4   57     5  18          0
-#> 19     30     322 11.5   68     5  19          0
-#> 20     11      44  9.7   62     5  20          0
-#> 21      1       8  9.7   59     5  21          0
-#> 22     11     320 16.6   73     5  22          0
-#> 23      4      25  9.7   61     5  23          0
-#> 24     32      92 12.0   61     5  24          0
-#> 25     NA      66 16.6   57     5  25          1
-#> 26     NA     266 14.9   58     5  26          1
-#> 27     NA      NA  8.0   57     5  27          2
-#> 28     23      13 12.0   67     5  28          0
-#> 29     45     252 14.9   81     5  29          0
-#> 30    115     223  5.7   79     5  30          0
-#> 31     37     279  7.4   76     5  31          0
-#> 32     NA     286  8.6   78     6   1          1
-#> 33     NA     287  9.7   74     6   2          1
-#> 34     NA     242 16.1   67     6   3          1
-#> 35     NA     186  9.2   84     6   4          1
-#> 36     NA     220  8.6   85     6   5          1
-#> 37     NA     264 14.3   79     6   6          1
-#> 38     29     127  9.7   82     6   7          0
-#> 39     NA     273  6.9   87     6   8          1
-#> 40     71     291 13.8   90     6   9          0
-#> 41     39     323 11.5   87     6  10          0
-#> 42     NA     259 10.9   93     6  11          1
-#> 43     NA     250  9.2   92     6  12          1
-#> 44     23     148  8.0   82     6  13          0
-#> 45     NA     332 13.8   80     6  14          1
-#> 46     NA     322 11.5   79     6  15          1
-#> 47     21     191 14.9   77     6  16          0
-#> 48     37     284 20.7   72     6  17          0
-#> 49     20      37  9.2   65     6  18          0
-#> 50     12     120 11.5   73     6  19          0
-#> 51     13     137 10.3   76     6  20          0
-#> 52     NA     150  6.3   77     6  21          1
-#> 53     NA      59  1.7   76     6  22          1
-#> 54     NA      91  4.6   76     6  23          1
-#> 55     NA     250  6.3   76     6  24          1
-#> 56     NA     135  8.0   75     6  25          1
-#> 57     NA     127  8.0   78     6  26          1
-#> 58     NA      47 10.3   73     6  27          1
-#> 59     NA      98 11.5   80     6  28          1
-#> 60     NA      31 14.9   77     6  29          1
-#> 61     NA     138  8.0   83     6  30          1
-#> 62    135     269  4.1   84     7   1          0
-#> 63     49     248  9.2   85     7   2          0
-#> 64     32     236  9.2   81     7   3          0
-#> 65     NA     101 10.9   84     7   4          1
-#> 66     64     175  4.6   83     7   5          0
-#> 67     40     314 10.9   83     7   6          0
-#> 68     77     276  5.1   88     7   7          0
-#> 69     97     267  6.3   92     7   8          0
-#> 70     97     272  5.7   92     7   9          0
-#> 71     85     175  7.4   89     7  10          0
-#> 72     NA     139  8.6   82     7  11          1
-#> 73     10     264 14.3   73     7  12          0
-#> 74     27     175 14.9   81     7  13          0
-#> 75     NA     291 14.9   91     7  14          1
-#> 76      7      48 14.3   80     7  15          0
-#> 77     48     260  6.9   81     7  16          0
-#> 78     35     274 10.3   82     7  17          0
-#> 79     61     285  6.3   84     7  18          0
-#> 80     79     187  5.1   87     7  19          0
-#> 81     63     220 11.5   85     7  20          0
-#> 82     16       7  6.9   74     7  21          0
-#> 83     NA     258  9.7   81     7  22          1
-#> 84     NA     295 11.5   82     7  23          1
-#> 85     80     294  8.6   86     7  24          0
-#> 86    108     223  8.0   85     7  25          0
-#> 87     20      81  8.6   82     7  26          0
-#> 88     52      82 12.0   86     7  27          0
-#> 89     82     213  7.4   88     7  28          0
-#> 90     50     275  7.4   86     7  29          0
-#> 91     64     253  7.4   83     7  30          0
-#> 92     59     254  9.2   81     7  31          0
-#> 93     39      83  6.9   81     8   1          0
-#> 94      9      24 13.8   81     8   2          0
-#> 95     16      77  7.4   82     8   3          0
-#> 96     78      NA  6.9   86     8   4          1
-#> 97     35      NA  7.4   85     8   5          1
-#> 98     66      NA  4.6   87     8   6          1
-#> 99    122     255  4.0   89     8   7          0
-#> 100    89     229 10.3   90     8   8          0
-#> 101   110     207  8.0   90     8   9          0
-#> 102    NA     222  8.6   92     8  10          1
-#> 103    NA     137 11.5   86     8  11          1
-#> 104    44     192 11.5   86     8  12          0
-#> 105    28     273 11.5   82     8  13          0
-#> 106    65     157  9.7   80     8  14          0
-#> 107    NA      64 11.5   79     8  15          1
-#> 108    22      71 10.3   77     8  16          0
-#> 109    59      51  6.3   79     8  17          0
-#> 110    23     115  7.4   76     8  18          0
-#> 111    31     244 10.9   78     8  19          0
-#> 112    44     190 10.3   78     8  20          0
-#> 113    21     259 15.5   77     8  21          0
-#> 114     9      36 14.3   72     8  22          0
-#> 115    NA     255 12.6   75     8  23          1
-#> 116    45     212  9.7   79     8  24          0
-#> 117   168     238  3.4   81     8  25          0
-#> 118    73     215  8.0   86     8  26          0
-#> 119    NA     153  5.7   88     8  27          1
-#> 120    76     203  9.7   97     8  28          0
-#> 121   118     225  2.3   94     8  29          0
-#> 122    84     237  6.3   96     8  30          0
-#> 123    85     188  6.3   94     8  31          0
-#> 124    96     167  6.9   91     9   1          0
-#> 125    78     197  5.1   92     9   2          0
-#> 126    73     183  2.8   93     9   3          0
-#> 127    91     189  4.6   93     9   4          0
-#> 128    47      95  7.4   87     9   5          0
-#> 129    32      92 15.5   84     9   6          0
-#> 130    20     252 10.9   80     9   7          0
-#> 131    23     220 10.3   78     9   8          0
-#> 132    21     230 10.9   75     9   9          0
-#> 133    24     259  9.7   73     9  10          0
-#> 134    44     236 14.9   81     9  11          0
-#> 135    21     259 15.5   76     9  12          0
-#> 136    28     238  6.3   77     9  13          0
-#> 137     9      24 10.9   71     9  14          0
-#> 138    13     112 11.5   71     9  15          0
-#> 139    46     237  6.9   78     9  16          0
-#> 140    18     224 13.8   67     9  17          0
-#> 141    13      27 10.3   76     9  18          0
-#> 142    24     238 10.3   68     9  19          0
-#> 143    16     201  8.0   82     9  20          0
-#> 144    13     238 12.6   64     9  21          0
-#> 145    23      14  9.2   71     9  22          0
-#> 146    36     139 10.3   81     9  23          0
-#> 147     7      49 10.3   69     9  24          0
-#> 148    14      20 16.6   63     9  25          0
-#> 149    30     193  6.9   70     9  26          0
-#> 150    NA     145 13.2   77     9  27          1
-#> 151    14     191 14.3   75     9  28          0
-#> 152    18     131  8.0   76     9  29          0
-#> 153    20     223 11.5   68     9  30          0
-airquality %>% add_n_miss(Ozone, Solar.R)
-#>     Ozone Solar.R Wind Temp Month Day n_miss_vars
-#> 1      41     190  7.4   67     5   1           0
-#> 2      36     118  8.0   72     5   2           0
-#> 3      12     149 12.6   74     5   3           0
-#> 4      18     313 11.5   62     5   4           0
-#> 5      NA      NA 14.3   56     5   5           2
-#> 6      28      NA 14.9   66     5   6           1
-#> 7      23     299  8.6   65     5   7           0
-#> 8      19      99 13.8   59     5   8           0
-#> 9       8      19 20.1   61     5   9           0
-#> 10     NA     194  8.6   69     5  10           1
-#> 11      7      NA  6.9   74     5  11           1
-#> 12     16     256  9.7   69     5  12           0
-#> 13     11     290  9.2   66     5  13           0
-#> 14     14     274 10.9   68     5  14           0
-#> 15     18      65 13.2   58     5  15           0
-#> 16     14     334 11.5   64     5  16           0
-#> 17     34     307 12.0   66     5  17           0
-#> 18      6      78 18.4   57     5  18           0
-#> 19     30     322 11.5   68     5  19           0
-#> 20     11      44  9.7   62     5  20           0
-#> 21      1       8  9.7   59     5  21           0
-#> 22     11     320 16.6   73     5  22           0
-#> 23      4      25  9.7   61     5  23           0
-#> 24     32      92 12.0   61     5  24           0
-#> 25     NA      66 16.6   57     5  25           1
-#> 26     NA     266 14.9   58     5  26           1
-#> 27     NA      NA  8.0   57     5  27           2
-#> 28     23      13 12.0   67     5  28           0
-#> 29     45     252 14.9   81     5  29           0
-#> 30    115     223  5.7   79     5  30           0
-#> 31     37     279  7.4   76     5  31           0
-#> 32     NA     286  8.6   78     6   1           1
-#> 33     NA     287  9.7   74     6   2           1
-#> 34     NA     242 16.1   67     6   3           1
-#> 35     NA     186  9.2   84     6   4           1
-#> 36     NA     220  8.6   85     6   5           1
-#> 37     NA     264 14.3   79     6   6           1
-#> 38     29     127  9.7   82     6   7           0
-#> 39     NA     273  6.9   87     6   8           1
-#> 40     71     291 13.8   90     6   9           0
-#> 41     39     323 11.5   87     6  10           0
-#> 42     NA     259 10.9   93     6  11           1
-#> 43     NA     250  9.2   92     6  12           1
-#> 44     23     148  8.0   82     6  13           0
-#> 45     NA     332 13.8   80     6  14           1
-#> 46     NA     322 11.5   79     6  15           1
-#> 47     21     191 14.9   77     6  16           0
-#> 48     37     284 20.7   72     6  17           0
-#> 49     20      37  9.2   65     6  18           0
-#> 50     12     120 11.5   73     6  19           0
-#> 51     13     137 10.3   76     6  20           0
-#> 52     NA     150  6.3   77     6  21           1
-#> 53     NA      59  1.7   76     6  22           1
-#> 54     NA      91  4.6   76     6  23           1
-#> 55     NA     250  6.3   76     6  24           1
-#> 56     NA     135  8.0   75     6  25           1
-#> 57     NA     127  8.0   78     6  26           1
-#> 58     NA      47 10.3   73     6  27           1
-#> 59     NA      98 11.5   80     6  28           1
-#> 60     NA      31 14.9   77     6  29           1
-#> 61     NA     138  8.0   83     6  30           1
-#> 62    135     269  4.1   84     7   1           0
-#> 63     49     248  9.2   85     7   2           0
-#> 64     32     236  9.2   81     7   3           0
-#> 65     NA     101 10.9   84     7   4           1
-#> 66     64     175  4.6   83     7   5           0
-#> 67     40     314 10.9   83     7   6           0
-#> 68     77     276  5.1   88     7   7           0
-#> 69     97     267  6.3   92     7   8           0
-#> 70     97     272  5.7   92     7   9           0
-#> 71     85     175  7.4   89     7  10           0
-#> 72     NA     139  8.6   82     7  11           1
-#> 73     10     264 14.3   73     7  12           0
-#> 74     27     175 14.9   81     7  13           0
-#> 75     NA     291 14.9   91     7  14           1
-#> 76      7      48 14.3   80     7  15           0
-#> 77     48     260  6.9   81     7  16           0
-#> 78     35     274 10.3   82     7  17           0
-#> 79     61     285  6.3   84     7  18           0
-#> 80     79     187  5.1   87     7  19           0
-#> 81     63     220 11.5   85     7  20           0
-#> 82     16       7  6.9   74     7  21           0
-#> 83     NA     258  9.7   81     7  22           1
-#> 84     NA     295 11.5   82     7  23           1
-#> 85     80     294  8.6   86     7  24           0
-#> 86    108     223  8.0   85     7  25           0
-#> 87     20      81  8.6   82     7  26           0
-#> 88     52      82 12.0   86     7  27           0
-#> 89     82     213  7.4   88     7  28           0
-#> 90     50     275  7.4   86     7  29           0
-#> 91     64     253  7.4   83     7  30           0
-#> 92     59     254  9.2   81     7  31           0
-#> 93     39      83  6.9   81     8   1           0
-#> 94      9      24 13.8   81     8   2           0
-#> 95     16      77  7.4   82     8   3           0
-#> 96     78      NA  6.9   86     8   4           1
-#> 97     35      NA  7.4   85     8   5           1
-#> 98     66      NA  4.6   87     8   6           1
-#> 99    122     255  4.0   89     8   7           0
-#> 100    89     229 10.3   90     8   8           0
-#> 101   110     207  8.0   90     8   9           0
-#> 102    NA     222  8.6   92     8  10           1
-#> 103    NA     137 11.5   86     8  11           1
-#> 104    44     192 11.5   86     8  12           0
-#> 105    28     273 11.5   82     8  13           0
-#> 106    65     157  9.7   80     8  14           0
-#> 107    NA      64 11.5   79     8  15           1
-#> 108    22      71 10.3   77     8  16           0
-#> 109    59      51  6.3   79     8  17           0
-#> 110    23     115  7.4   76     8  18           0
-#> 111    31     244 10.9   78     8  19           0
-#> 112    44     190 10.3   78     8  20           0
-#> 113    21     259 15.5   77     8  21           0
-#> 114     9      36 14.3   72     8  22           0
-#> 115    NA     255 12.6   75     8  23           1
-#> 116    45     212  9.7   79     8  24           0
-#> 117   168     238  3.4   81     8  25           0
-#> 118    73     215  8.0   86     8  26           0
-#> 119    NA     153  5.7   88     8  27           1
-#> 120    76     203  9.7   97     8  28           0
-#> 121   118     225  2.3   94     8  29           0
-#> 122    84     237  6.3   96     8  30           0
-#> 123    85     188  6.3   94     8  31           0
-#> 124    96     167  6.9   91     9   1           0
-#> 125    78     197  5.1   92     9   2           0
-#> 126    73     183  2.8   93     9   3           0
-#> 127    91     189  4.6   93     9   4           0
-#> 128    47      95  7.4   87     9   5           0
-#> 129    32      92 15.5   84     9   6           0
-#> 130    20     252 10.9   80     9   7           0
-#> 131    23     220 10.3   78     9   8           0
-#> 132    21     230 10.9   75     9   9           0
-#> 133    24     259  9.7   73     9  10           0
-#> 134    44     236 14.9   81     9  11           0
-#> 135    21     259 15.5   76     9  12           0
-#> 136    28     238  6.3   77     9  13           0
-#> 137     9      24 10.9   71     9  14           0
-#> 138    13     112 11.5   71     9  15           0
-#> 139    46     237  6.9   78     9  16           0
-#> 140    18     224 13.8   67     9  17           0
-#> 141    13      27 10.3   76     9  18           0
-#> 142    24     238 10.3   68     9  19           0
-#> 143    16     201  8.0   82     9  20           0
-#> 144    13     238 12.6   64     9  21           0
-#> 145    23      14  9.2   71     9  22           0
-#> 146    36     139 10.3   81     9  23           0
-#> 147     7      49 10.3   69     9  24           0
-#> 148    14      20 16.6   63     9  25           0
-#> 149    30     193  6.9   70     9  26           0
-#> 150    NA     145 13.2   77     9  27           1
-#> 151    14     191 14.3   75     9  28           0
-#> 152    18     131  8.0   76     9  29           0
-#> 153    20     223 11.5   68     9  30           0
-airquality %>% add_n_miss(dplyr::contains("o"))
-#>     Ozone Solar.R Wind Temp Month Day n_miss_vars
-#> 1      41     190  7.4   67     5   1           0
-#> 2      36     118  8.0   72     5   2           0
-#> 3      12     149 12.6   74     5   3           0
-#> 4      18     313 11.5   62     5   4           0
-#> 5      NA      NA 14.3   56     5   5           2
-#> 6      28      NA 14.9   66     5   6           1
-#> 7      23     299  8.6   65     5   7           0
-#> 8      19      99 13.8   59     5   8           0
-#> 9       8      19 20.1   61     5   9           0
-#> 10     NA     194  8.6   69     5  10           1
-#> 11      7      NA  6.9   74     5  11           1
-#> 12     16     256  9.7   69     5  12           0
-#> 13     11     290  9.2   66     5  13           0
-#> 14     14     274 10.9   68     5  14           0
-#> 15     18      65 13.2   58     5  15           0
-#> 16     14     334 11.5   64     5  16           0
-#> 17     34     307 12.0   66     5  17           0
-#> 18      6      78 18.4   57     5  18           0
-#> 19     30     322 11.5   68     5  19           0
-#> 20     11      44  9.7   62     5  20           0
-#> 21      1       8  9.7   59     5  21           0
-#> 22     11     320 16.6   73     5  22           0
-#> 23      4      25  9.7   61     5  23           0
-#> 24     32      92 12.0   61     5  24           0
-#> 25     NA      66 16.6   57     5  25           1
-#> 26     NA     266 14.9   58     5  26           1
-#> 27     NA      NA  8.0   57     5  27           2
-#> 28     23      13 12.0   67     5  28           0
-#> 29     45     252 14.9   81     5  29           0
-#> 30    115     223  5.7   79     5  30           0
-#> 31     37     279  7.4   76     5  31           0
-#> 32     NA     286  8.6   78     6   1           1
-#> 33     NA     287  9.7   74     6   2           1
-#> 34     NA     242 16.1   67     6   3           1
-#> 35     NA     186  9.2   84     6   4           1
-#> 36     NA     220  8.6   85     6   5           1
-#> 37     NA     264 14.3   79     6   6           1
-#> 38     29     127  9.7   82     6   7           0
-#> 39     NA     273  6.9   87     6   8           1
-#> 40     71     291 13.8   90     6   9           0
-#> 41     39     323 11.5   87     6  10           0
-#> 42     NA     259 10.9   93     6  11           1
-#> 43     NA     250  9.2   92     6  12           1
-#> 44     23     148  8.0   82     6  13           0
-#> 45     NA     332 13.8   80     6  14           1
-#> 46     NA     322 11.5   79     6  15           1
-#> 47     21     191 14.9   77     6  16           0
-#> 48     37     284 20.7   72     6  17           0
-#> 49     20      37  9.2   65     6  18           0
-#> 50     12     120 11.5   73     6  19           0
-#> 51     13     137 10.3   76     6  20           0
-#> 52     NA     150  6.3   77     6  21           1
-#> 53     NA      59  1.7   76     6  22           1
-#> 54     NA      91  4.6   76     6  23           1
-#> 55     NA     250  6.3   76     6  24           1
-#> 56     NA     135  8.0   75     6  25           1
-#> 57     NA     127  8.0   78     6  26           1
-#> 58     NA      47 10.3   73     6  27           1
-#> 59     NA      98 11.5   80     6  28           1
-#> 60     NA      31 14.9   77     6  29           1
-#> 61     NA     138  8.0   83     6  30           1
-#> 62    135     269  4.1   84     7   1           0
-#> 63     49     248  9.2   85     7   2           0
-#> 64     32     236  9.2   81     7   3           0
-#> 65     NA     101 10.9   84     7   4           1
-#> 66     64     175  4.6   83     7   5           0
-#> 67     40     314 10.9   83     7   6           0
-#> 68     77     276  5.1   88     7   7           0
-#> 69     97     267  6.3   92     7   8           0
-#> 70     97     272  5.7   92     7   9           0
-#> 71     85     175  7.4   89     7  10           0
-#> 72     NA     139  8.6   82     7  11           1
-#> 73     10     264 14.3   73     7  12           0
-#> 74     27     175 14.9   81     7  13           0
-#> 75     NA     291 14.9   91     7  14           1
-#> 76      7      48 14.3   80     7  15           0
-#> 77     48     260  6.9   81     7  16           0
-#> 78     35     274 10.3   82     7  17           0
-#> 79     61     285  6.3   84     7  18           0
-#> 80     79     187  5.1   87     7  19           0
-#> 81     63     220 11.5   85     7  20           0
-#> 82     16       7  6.9   74     7  21           0
-#> 83     NA     258  9.7   81     7  22           1
-#> 84     NA     295 11.5   82     7  23           1
-#> 85     80     294  8.6   86     7  24           0
-#> 86    108     223  8.0   85     7  25           0
-#> 87     20      81  8.6   82     7  26           0
-#> 88     52      82 12.0   86     7  27           0
-#> 89     82     213  7.4   88     7  28           0
-#> 90     50     275  7.4   86     7  29           0
-#> 91     64     253  7.4   83     7  30           0
-#> 92     59     254  9.2   81     7  31           0
-#> 93     39      83  6.9   81     8   1           0
-#> 94      9      24 13.8   81     8   2           0
-#> 95     16      77  7.4   82     8   3           0
-#> 96     78      NA  6.9   86     8   4           1
-#> 97     35      NA  7.4   85     8   5           1
-#> 98     66      NA  4.6   87     8   6           1
-#> 99    122     255  4.0   89     8   7           0
-#> 100    89     229 10.3   90     8   8           0
-#> 101   110     207  8.0   90     8   9           0
-#> 102    NA     222  8.6   92     8  10           1
-#> 103    NA     137 11.5   86     8  11           1
-#> 104    44     192 11.5   86     8  12           0
-#> 105    28     273 11.5   82     8  13           0
-#> 106    65     157  9.7   80     8  14           0
-#> 107    NA      64 11.5   79     8  15           1
-#> 108    22      71 10.3   77     8  16           0
-#> 109    59      51  6.3   79     8  17           0
-#> 110    23     115  7.4   76     8  18           0
-#> 111    31     244 10.9   78     8  19           0
-#> 112    44     190 10.3   78     8  20           0
-#> 113    21     259 15.5   77     8  21           0
-#> 114     9      36 14.3   72     8  22           0
-#> 115    NA     255 12.6   75     8  23           1
-#> 116    45     212  9.7   79     8  24           0
-#> 117   168     238  3.4   81     8  25           0
-#> 118    73     215  8.0   86     8  26           0
-#> 119    NA     153  5.7   88     8  27           1
-#> 120    76     203  9.7   97     8  28           0
-#> 121   118     225  2.3   94     8  29           0
-#> 122    84     237  6.3   96     8  30           0
-#> 123    85     188  6.3   94     8  31           0
-#> 124    96     167  6.9   91     9   1           0
-#> 125    78     197  5.1   92     9   2           0
-#> 126    73     183  2.8   93     9   3           0
-#> 127    91     189  4.6   93     9   4           0
-#> 128    47      95  7.4   87     9   5           0
-#> 129    32      92 15.5   84     9   6           0
-#> 130    20     252 10.9   80     9   7           0
-#> 131    23     220 10.3   78     9   8           0
-#> 132    21     230 10.9   75     9   9           0
-#> 133    24     259  9.7   73     9  10           0
-#> 134    44     236 14.9   81     9  11           0
-#> 135    21     259 15.5   76     9  12           0
-#> 136    28     238  6.3   77     9  13           0
-#> 137     9      24 10.9   71     9  14           0
-#> 138    13     112 11.5   71     9  15           0
-#> 139    46     237  6.9   78     9  16           0
-#> 140    18     224 13.8   67     9  17           0
-#> 141    13      27 10.3   76     9  18           0
-#> 142    24     238 10.3   68     9  19           0
-#> 143    16     201  8.0   82     9  20           0
-#> 144    13     238 12.6   64     9  21           0
-#> 145    23      14  9.2   71     9  22           0
-#> 146    36     139 10.3   81     9  23           0
-#> 147     7      49 10.3   69     9  24           0
-#> 148    14      20 16.6   63     9  25           0
-#> 149    30     193  6.9   70     9  26           0
-#> 150    NA     145 13.2   77     9  27           1
-#> 151    14     191 14.3   75     9  28           0
-#> 152    18     131  8.0   76     9  29           0
-#> 153    20     223 11.5   68     9  30           0
-
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/add_prop_miss-1.png b/docs/reference/add_prop_miss-1.png deleted file mode 100644 index 72044ee3..00000000 Binary files a/docs/reference/add_prop_miss-1.png and /dev/null differ diff --git a/docs/reference/add_prop_miss-2.png b/docs/reference/add_prop_miss-2.png deleted file mode 100644 index af19d234..00000000 Binary files a/docs/reference/add_prop_miss-2.png and /dev/null differ diff --git a/docs/reference/add_prop_miss-3.png b/docs/reference/add_prop_miss-3.png deleted file mode 100644 index 3a57d3e3..00000000 Binary files a/docs/reference/add_prop_miss-3.png and /dev/null differ diff --git a/docs/reference/add_prop_miss-4.png b/docs/reference/add_prop_miss-4.png deleted file mode 100644 index bed0c6f7..00000000 Binary files a/docs/reference/add_prop_miss-4.png and /dev/null differ diff --git a/docs/reference/add_prop_miss-5.png b/docs/reference/add_prop_miss-5.png deleted file mode 100644 index bed0c6f7..00000000 Binary files a/docs/reference/add_prop_miss-5.png and /dev/null differ diff --git a/docs/reference/add_prop_miss-6.png b/docs/reference/add_prop_miss-6.png deleted file mode 100644 index bed0c6f7..00000000 Binary files a/docs/reference/add_prop_miss-6.png and /dev/null differ diff --git a/docs/reference/add_prop_miss-7.png b/docs/reference/add_prop_miss-7.png deleted file mode 100644 index bed0c6f7..00000000 Binary files a/docs/reference/add_prop_miss-7.png and /dev/null differ diff --git a/docs/reference/add_prop_miss-8.png b/docs/reference/add_prop_miss-8.png deleted file mode 100644 index bed0c6f7..00000000 Binary files a/docs/reference/add_prop_miss-8.png and /dev/null differ diff --git a/docs/reference/add_prop_miss-9.png b/docs/reference/add_prop_miss-9.png deleted file mode 100644 index bed0c6f7..00000000 Binary files a/docs/reference/add_prop_miss-9.png and /dev/null differ diff --git a/docs/reference/add_prop_miss.html b/docs/reference/add_prop_miss.html deleted file mode 100644 index cddd7cc5..00000000 --- a/docs/reference/add_prop_miss.html +++ /dev/null @@ -1,607 +0,0 @@ - -Add column containing proportion of missing data values — add_prop_miss • naniar - Skip to contents - - -
-
-
- -
-

It can be useful when doing data analysis to add the proportion of missing -data values into your dataframe. add_prop_miss adds a column named -"prop_miss", which contains the proportion of missing values in that row. -You can specify the variables that you would like to show the missingness -for.

-
- -
-

Usage

-
add_prop_miss(data, ..., label = "prop_miss")
-
- -
-

Arguments

-
data
-

a dataframe

- - -
...
-

Variable names to use instead of the whole dataset. By default this -looks at the whole dataset. Otherwise, this is one or more unquoted -expressions separated by commas. These also respect the dplyr verbs -starts_with, contains, ends_with, etc. By default will add "_all" to -the label if left blank, otherwise will add "_vars" to distinguish that it -has not been used on all of the variables.

- - -
label
-

character string of what you need to name variable

- -
-
-

Value

- - -

a dataframe

-
- - -
-

Examples

-

-airquality %>% add_prop_miss()
-#>     Ozone Solar.R Wind Temp Month Day prop_miss_all
-#> 1      41     190  7.4   67     5   1     0.0000000
-#> 2      36     118  8.0   72     5   2     0.0000000
-#> 3      12     149 12.6   74     5   3     0.0000000
-#> 4      18     313 11.5   62     5   4     0.0000000
-#> 5      NA      NA 14.3   56     5   5     0.3333333
-#> 6      28      NA 14.9   66     5   6     0.1666667
-#> 7      23     299  8.6   65     5   7     0.0000000
-#> 8      19      99 13.8   59     5   8     0.0000000
-#> 9       8      19 20.1   61     5   9     0.0000000
-#> 10     NA     194  8.6   69     5  10     0.1666667
-#> 11      7      NA  6.9   74     5  11     0.1666667
-#> 12     16     256  9.7   69     5  12     0.0000000
-#> 13     11     290  9.2   66     5  13     0.0000000
-#> 14     14     274 10.9   68     5  14     0.0000000
-#> 15     18      65 13.2   58     5  15     0.0000000
-#> 16     14     334 11.5   64     5  16     0.0000000
-#> 17     34     307 12.0   66     5  17     0.0000000
-#> 18      6      78 18.4   57     5  18     0.0000000
-#> 19     30     322 11.5   68     5  19     0.0000000
-#> 20     11      44  9.7   62     5  20     0.0000000
-#> 21      1       8  9.7   59     5  21     0.0000000
-#> 22     11     320 16.6   73     5  22     0.0000000
-#> 23      4      25  9.7   61     5  23     0.0000000
-#> 24     32      92 12.0   61     5  24     0.0000000
-#> 25     NA      66 16.6   57     5  25     0.1666667
-#> 26     NA     266 14.9   58     5  26     0.1666667
-#> 27     NA      NA  8.0   57     5  27     0.3333333
-#> 28     23      13 12.0   67     5  28     0.0000000
-#> 29     45     252 14.9   81     5  29     0.0000000
-#> 30    115     223  5.7   79     5  30     0.0000000
-#> 31     37     279  7.4   76     5  31     0.0000000
-#> 32     NA     286  8.6   78     6   1     0.1666667
-#> 33     NA     287  9.7   74     6   2     0.1666667
-#> 34     NA     242 16.1   67     6   3     0.1666667
-#> 35     NA     186  9.2   84     6   4     0.1666667
-#> 36     NA     220  8.6   85     6   5     0.1666667
-#> 37     NA     264 14.3   79     6   6     0.1666667
-#> 38     29     127  9.7   82     6   7     0.0000000
-#> 39     NA     273  6.9   87     6   8     0.1666667
-#> 40     71     291 13.8   90     6   9     0.0000000
-#> 41     39     323 11.5   87     6  10     0.0000000
-#> 42     NA     259 10.9   93     6  11     0.1666667
-#> 43     NA     250  9.2   92     6  12     0.1666667
-#> 44     23     148  8.0   82     6  13     0.0000000
-#> 45     NA     332 13.8   80     6  14     0.1666667
-#> 46     NA     322 11.5   79     6  15     0.1666667
-#> 47     21     191 14.9   77     6  16     0.0000000
-#> 48     37     284 20.7   72     6  17     0.0000000
-#> 49     20      37  9.2   65     6  18     0.0000000
-#> 50     12     120 11.5   73     6  19     0.0000000
-#> 51     13     137 10.3   76     6  20     0.0000000
-#> 52     NA     150  6.3   77     6  21     0.1666667
-#> 53     NA      59  1.7   76     6  22     0.1666667
-#> 54     NA      91  4.6   76     6  23     0.1666667
-#> 55     NA     250  6.3   76     6  24     0.1666667
-#> 56     NA     135  8.0   75     6  25     0.1666667
-#> 57     NA     127  8.0   78     6  26     0.1666667
-#> 58     NA      47 10.3   73     6  27     0.1666667
-#> 59     NA      98 11.5   80     6  28     0.1666667
-#> 60     NA      31 14.9   77     6  29     0.1666667
-#> 61     NA     138  8.0   83     6  30     0.1666667
-#> 62    135     269  4.1   84     7   1     0.0000000
-#> 63     49     248  9.2   85     7   2     0.0000000
-#> 64     32     236  9.2   81     7   3     0.0000000
-#> 65     NA     101 10.9   84     7   4     0.1666667
-#> 66     64     175  4.6   83     7   5     0.0000000
-#> 67     40     314 10.9   83     7   6     0.0000000
-#> 68     77     276  5.1   88     7   7     0.0000000
-#> 69     97     267  6.3   92     7   8     0.0000000
-#> 70     97     272  5.7   92     7   9     0.0000000
-#> 71     85     175  7.4   89     7  10     0.0000000
-#> 72     NA     139  8.6   82     7  11     0.1666667
-#> 73     10     264 14.3   73     7  12     0.0000000
-#> 74     27     175 14.9   81     7  13     0.0000000
-#> 75     NA     291 14.9   91     7  14     0.1666667
-#> 76      7      48 14.3   80     7  15     0.0000000
-#> 77     48     260  6.9   81     7  16     0.0000000
-#> 78     35     274 10.3   82     7  17     0.0000000
-#> 79     61     285  6.3   84     7  18     0.0000000
-#> 80     79     187  5.1   87     7  19     0.0000000
-#> 81     63     220 11.5   85     7  20     0.0000000
-#> 82     16       7  6.9   74     7  21     0.0000000
-#> 83     NA     258  9.7   81     7  22     0.1666667
-#> 84     NA     295 11.5   82     7  23     0.1666667
-#> 85     80     294  8.6   86     7  24     0.0000000
-#> 86    108     223  8.0   85     7  25     0.0000000
-#> 87     20      81  8.6   82     7  26     0.0000000
-#> 88     52      82 12.0   86     7  27     0.0000000
-#> 89     82     213  7.4   88     7  28     0.0000000
-#> 90     50     275  7.4   86     7  29     0.0000000
-#> 91     64     253  7.4   83     7  30     0.0000000
-#> 92     59     254  9.2   81     7  31     0.0000000
-#> 93     39      83  6.9   81     8   1     0.0000000
-#> 94      9      24 13.8   81     8   2     0.0000000
-#> 95     16      77  7.4   82     8   3     0.0000000
-#> 96     78      NA  6.9   86     8   4     0.1666667
-#> 97     35      NA  7.4   85     8   5     0.1666667
-#> 98     66      NA  4.6   87     8   6     0.1666667
-#> 99    122     255  4.0   89     8   7     0.0000000
-#> 100    89     229 10.3   90     8   8     0.0000000
-#> 101   110     207  8.0   90     8   9     0.0000000
-#> 102    NA     222  8.6   92     8  10     0.1666667
-#> 103    NA     137 11.5   86     8  11     0.1666667
-#> 104    44     192 11.5   86     8  12     0.0000000
-#> 105    28     273 11.5   82     8  13     0.0000000
-#> 106    65     157  9.7   80     8  14     0.0000000
-#> 107    NA      64 11.5   79     8  15     0.1666667
-#> 108    22      71 10.3   77     8  16     0.0000000
-#> 109    59      51  6.3   79     8  17     0.0000000
-#> 110    23     115  7.4   76     8  18     0.0000000
-#> 111    31     244 10.9   78     8  19     0.0000000
-#> 112    44     190 10.3   78     8  20     0.0000000
-#> 113    21     259 15.5   77     8  21     0.0000000
-#> 114     9      36 14.3   72     8  22     0.0000000
-#> 115    NA     255 12.6   75     8  23     0.1666667
-#> 116    45     212  9.7   79     8  24     0.0000000
-#> 117   168     238  3.4   81     8  25     0.0000000
-#> 118    73     215  8.0   86     8  26     0.0000000
-#> 119    NA     153  5.7   88     8  27     0.1666667
-#> 120    76     203  9.7   97     8  28     0.0000000
-#> 121   118     225  2.3   94     8  29     0.0000000
-#> 122    84     237  6.3   96     8  30     0.0000000
-#> 123    85     188  6.3   94     8  31     0.0000000
-#> 124    96     167  6.9   91     9   1     0.0000000
-#> 125    78     197  5.1   92     9   2     0.0000000
-#> 126    73     183  2.8   93     9   3     0.0000000
-#> 127    91     189  4.6   93     9   4     0.0000000
-#> 128    47      95  7.4   87     9   5     0.0000000
-#> 129    32      92 15.5   84     9   6     0.0000000
-#> 130    20     252 10.9   80     9   7     0.0000000
-#> 131    23     220 10.3   78     9   8     0.0000000
-#> 132    21     230 10.9   75     9   9     0.0000000
-#> 133    24     259  9.7   73     9  10     0.0000000
-#> 134    44     236 14.9   81     9  11     0.0000000
-#> 135    21     259 15.5   76     9  12     0.0000000
-#> 136    28     238  6.3   77     9  13     0.0000000
-#> 137     9      24 10.9   71     9  14     0.0000000
-#> 138    13     112 11.5   71     9  15     0.0000000
-#> 139    46     237  6.9   78     9  16     0.0000000
-#> 140    18     224 13.8   67     9  17     0.0000000
-#> 141    13      27 10.3   76     9  18     0.0000000
-#> 142    24     238 10.3   68     9  19     0.0000000
-#> 143    16     201  8.0   82     9  20     0.0000000
-#> 144    13     238 12.6   64     9  21     0.0000000
-#> 145    23      14  9.2   71     9  22     0.0000000
-#> 146    36     139 10.3   81     9  23     0.0000000
-#> 147     7      49 10.3   69     9  24     0.0000000
-#> 148    14      20 16.6   63     9  25     0.0000000
-#> 149    30     193  6.9   70     9  26     0.0000000
-#> 150    NA     145 13.2   77     9  27     0.1666667
-#> 151    14     191 14.3   75     9  28     0.0000000
-#> 152    18     131  8.0   76     9  29     0.0000000
-#> 153    20     223 11.5   68     9  30     0.0000000
-airquality %>% add_prop_miss(Solar.R, Ozone)
-#>     Ozone Solar.R Wind Temp Month Day prop_miss_vars
-#> 1      41     190  7.4   67     5   1            0.0
-#> 2      36     118  8.0   72     5   2            0.0
-#> 3      12     149 12.6   74     5   3            0.0
-#> 4      18     313 11.5   62     5   4            0.0
-#> 5      NA      NA 14.3   56     5   5            1.0
-#> 6      28      NA 14.9   66     5   6            0.5
-#> 7      23     299  8.6   65     5   7            0.0
-#> 8      19      99 13.8   59     5   8            0.0
-#> 9       8      19 20.1   61     5   9            0.0
-#> 10     NA     194  8.6   69     5  10            0.5
-#> 11      7      NA  6.9   74     5  11            0.5
-#> 12     16     256  9.7   69     5  12            0.0
-#> 13     11     290  9.2   66     5  13            0.0
-#> 14     14     274 10.9   68     5  14            0.0
-#> 15     18      65 13.2   58     5  15            0.0
-#> 16     14     334 11.5   64     5  16            0.0
-#> 17     34     307 12.0   66     5  17            0.0
-#> 18      6      78 18.4   57     5  18            0.0
-#> 19     30     322 11.5   68     5  19            0.0
-#> 20     11      44  9.7   62     5  20            0.0
-#> 21      1       8  9.7   59     5  21            0.0
-#> 22     11     320 16.6   73     5  22            0.0
-#> 23      4      25  9.7   61     5  23            0.0
-#> 24     32      92 12.0   61     5  24            0.0
-#> 25     NA      66 16.6   57     5  25            0.5
-#> 26     NA     266 14.9   58     5  26            0.5
-#> 27     NA      NA  8.0   57     5  27            1.0
-#> 28     23      13 12.0   67     5  28            0.0
-#> 29     45     252 14.9   81     5  29            0.0
-#> 30    115     223  5.7   79     5  30            0.0
-#> 31     37     279  7.4   76     5  31            0.0
-#> 32     NA     286  8.6   78     6   1            0.5
-#> 33     NA     287  9.7   74     6   2            0.5
-#> 34     NA     242 16.1   67     6   3            0.5
-#> 35     NA     186  9.2   84     6   4            0.5
-#> 36     NA     220  8.6   85     6   5            0.5
-#> 37     NA     264 14.3   79     6   6            0.5
-#> 38     29     127  9.7   82     6   7            0.0
-#> 39     NA     273  6.9   87     6   8            0.5
-#> 40     71     291 13.8   90     6   9            0.0
-#> 41     39     323 11.5   87     6  10            0.0
-#> 42     NA     259 10.9   93     6  11            0.5
-#> 43     NA     250  9.2   92     6  12            0.5
-#> 44     23     148  8.0   82     6  13            0.0
-#> 45     NA     332 13.8   80     6  14            0.5
-#> 46     NA     322 11.5   79     6  15            0.5
-#> 47     21     191 14.9   77     6  16            0.0
-#> 48     37     284 20.7   72     6  17            0.0
-#> 49     20      37  9.2   65     6  18            0.0
-#> 50     12     120 11.5   73     6  19            0.0
-#> 51     13     137 10.3   76     6  20            0.0
-#> 52     NA     150  6.3   77     6  21            0.5
-#> 53     NA      59  1.7   76     6  22            0.5
-#> 54     NA      91  4.6   76     6  23            0.5
-#> 55     NA     250  6.3   76     6  24            0.5
-#> 56     NA     135  8.0   75     6  25            0.5
-#> 57     NA     127  8.0   78     6  26            0.5
-#> 58     NA      47 10.3   73     6  27            0.5
-#> 59     NA      98 11.5   80     6  28            0.5
-#> 60     NA      31 14.9   77     6  29            0.5
-#> 61     NA     138  8.0   83     6  30            0.5
-#> 62    135     269  4.1   84     7   1            0.0
-#> 63     49     248  9.2   85     7   2            0.0
-#> 64     32     236  9.2   81     7   3            0.0
-#> 65     NA     101 10.9   84     7   4            0.5
-#> 66     64     175  4.6   83     7   5            0.0
-#> 67     40     314 10.9   83     7   6            0.0
-#> 68     77     276  5.1   88     7   7            0.0
-#> 69     97     267  6.3   92     7   8            0.0
-#> 70     97     272  5.7   92     7   9            0.0
-#> 71     85     175  7.4   89     7  10            0.0
-#> 72     NA     139  8.6   82     7  11            0.5
-#> 73     10     264 14.3   73     7  12            0.0
-#> 74     27     175 14.9   81     7  13            0.0
-#> 75     NA     291 14.9   91     7  14            0.5
-#> 76      7      48 14.3   80     7  15            0.0
-#> 77     48     260  6.9   81     7  16            0.0
-#> 78     35     274 10.3   82     7  17            0.0
-#> 79     61     285  6.3   84     7  18            0.0
-#> 80     79     187  5.1   87     7  19            0.0
-#> 81     63     220 11.5   85     7  20            0.0
-#> 82     16       7  6.9   74     7  21            0.0
-#> 83     NA     258  9.7   81     7  22            0.5
-#> 84     NA     295 11.5   82     7  23            0.5
-#> 85     80     294  8.6   86     7  24            0.0
-#> 86    108     223  8.0   85     7  25            0.0
-#> 87     20      81  8.6   82     7  26            0.0
-#> 88     52      82 12.0   86     7  27            0.0
-#> 89     82     213  7.4   88     7  28            0.0
-#> 90     50     275  7.4   86     7  29            0.0
-#> 91     64     253  7.4   83     7  30            0.0
-#> 92     59     254  9.2   81     7  31            0.0
-#> 93     39      83  6.9   81     8   1            0.0
-#> 94      9      24 13.8   81     8   2            0.0
-#> 95     16      77  7.4   82     8   3            0.0
-#> 96     78      NA  6.9   86     8   4            0.5
-#> 97     35      NA  7.4   85     8   5            0.5
-#> 98     66      NA  4.6   87     8   6            0.5
-#> 99    122     255  4.0   89     8   7            0.0
-#> 100    89     229 10.3   90     8   8            0.0
-#> 101   110     207  8.0   90     8   9            0.0
-#> 102    NA     222  8.6   92     8  10            0.5
-#> 103    NA     137 11.5   86     8  11            0.5
-#> 104    44     192 11.5   86     8  12            0.0
-#> 105    28     273 11.5   82     8  13            0.0
-#> 106    65     157  9.7   80     8  14            0.0
-#> 107    NA      64 11.5   79     8  15            0.5
-#> 108    22      71 10.3   77     8  16            0.0
-#> 109    59      51  6.3   79     8  17            0.0
-#> 110    23     115  7.4   76     8  18            0.0
-#> 111    31     244 10.9   78     8  19            0.0
-#> 112    44     190 10.3   78     8  20            0.0
-#> 113    21     259 15.5   77     8  21            0.0
-#> 114     9      36 14.3   72     8  22            0.0
-#> 115    NA     255 12.6   75     8  23            0.5
-#> 116    45     212  9.7   79     8  24            0.0
-#> 117   168     238  3.4   81     8  25            0.0
-#> 118    73     215  8.0   86     8  26            0.0
-#> 119    NA     153  5.7   88     8  27            0.5
-#> 120    76     203  9.7   97     8  28            0.0
-#> 121   118     225  2.3   94     8  29            0.0
-#> 122    84     237  6.3   96     8  30            0.0
-#> 123    85     188  6.3   94     8  31            0.0
-#> 124    96     167  6.9   91     9   1            0.0
-#> 125    78     197  5.1   92     9   2            0.0
-#> 126    73     183  2.8   93     9   3            0.0
-#> 127    91     189  4.6   93     9   4            0.0
-#> 128    47      95  7.4   87     9   5            0.0
-#> 129    32      92 15.5   84     9   6            0.0
-#> 130    20     252 10.9   80     9   7            0.0
-#> 131    23     220 10.3   78     9   8            0.0
-#> 132    21     230 10.9   75     9   9            0.0
-#> 133    24     259  9.7   73     9  10            0.0
-#> 134    44     236 14.9   81     9  11            0.0
-#> 135    21     259 15.5   76     9  12            0.0
-#> 136    28     238  6.3   77     9  13            0.0
-#> 137     9      24 10.9   71     9  14            0.0
-#> 138    13     112 11.5   71     9  15            0.0
-#> 139    46     237  6.9   78     9  16            0.0
-#> 140    18     224 13.8   67     9  17            0.0
-#> 141    13      27 10.3   76     9  18            0.0
-#> 142    24     238 10.3   68     9  19            0.0
-#> 143    16     201  8.0   82     9  20            0.0
-#> 144    13     238 12.6   64     9  21            0.0
-#> 145    23      14  9.2   71     9  22            0.0
-#> 146    36     139 10.3   81     9  23            0.0
-#> 147     7      49 10.3   69     9  24            0.0
-#> 148    14      20 16.6   63     9  25            0.0
-#> 149    30     193  6.9   70     9  26            0.0
-#> 150    NA     145 13.2   77     9  27            0.5
-#> 151    14     191 14.3   75     9  28            0.0
-#> 152    18     131  8.0   76     9  29            0.0
-#> 153    20     223 11.5   68     9  30            0.0
-airquality %>% add_prop_miss(Solar.R, Ozone, label = "testing")
-#>     Ozone Solar.R Wind Temp Month Day testing_vars
-#> 1      41     190  7.4   67     5   1          0.0
-#> 2      36     118  8.0   72     5   2          0.0
-#> 3      12     149 12.6   74     5   3          0.0
-#> 4      18     313 11.5   62     5   4          0.0
-#> 5      NA      NA 14.3   56     5   5          1.0
-#> 6      28      NA 14.9   66     5   6          0.5
-#> 7      23     299  8.6   65     5   7          0.0
-#> 8      19      99 13.8   59     5   8          0.0
-#> 9       8      19 20.1   61     5   9          0.0
-#> 10     NA     194  8.6   69     5  10          0.5
-#> 11      7      NA  6.9   74     5  11          0.5
-#> 12     16     256  9.7   69     5  12          0.0
-#> 13     11     290  9.2   66     5  13          0.0
-#> 14     14     274 10.9   68     5  14          0.0
-#> 15     18      65 13.2   58     5  15          0.0
-#> 16     14     334 11.5   64     5  16          0.0
-#> 17     34     307 12.0   66     5  17          0.0
-#> 18      6      78 18.4   57     5  18          0.0
-#> 19     30     322 11.5   68     5  19          0.0
-#> 20     11      44  9.7   62     5  20          0.0
-#> 21      1       8  9.7   59     5  21          0.0
-#> 22     11     320 16.6   73     5  22          0.0
-#> 23      4      25  9.7   61     5  23          0.0
-#> 24     32      92 12.0   61     5  24          0.0
-#> 25     NA      66 16.6   57     5  25          0.5
-#> 26     NA     266 14.9   58     5  26          0.5
-#> 27     NA      NA  8.0   57     5  27          1.0
-#> 28     23      13 12.0   67     5  28          0.0
-#> 29     45     252 14.9   81     5  29          0.0
-#> 30    115     223  5.7   79     5  30          0.0
-#> 31     37     279  7.4   76     5  31          0.0
-#> 32     NA     286  8.6   78     6   1          0.5
-#> 33     NA     287  9.7   74     6   2          0.5
-#> 34     NA     242 16.1   67     6   3          0.5
-#> 35     NA     186  9.2   84     6   4          0.5
-#> 36     NA     220  8.6   85     6   5          0.5
-#> 37     NA     264 14.3   79     6   6          0.5
-#> 38     29     127  9.7   82     6   7          0.0
-#> 39     NA     273  6.9   87     6   8          0.5
-#> 40     71     291 13.8   90     6   9          0.0
-#> 41     39     323 11.5   87     6  10          0.0
-#> 42     NA     259 10.9   93     6  11          0.5
-#> 43     NA     250  9.2   92     6  12          0.5
-#> 44     23     148  8.0   82     6  13          0.0
-#> 45     NA     332 13.8   80     6  14          0.5
-#> 46     NA     322 11.5   79     6  15          0.5
-#> 47     21     191 14.9   77     6  16          0.0
-#> 48     37     284 20.7   72     6  17          0.0
-#> 49     20      37  9.2   65     6  18          0.0
-#> 50     12     120 11.5   73     6  19          0.0
-#> 51     13     137 10.3   76     6  20          0.0
-#> 52     NA     150  6.3   77     6  21          0.5
-#> 53     NA      59  1.7   76     6  22          0.5
-#> 54     NA      91  4.6   76     6  23          0.5
-#> 55     NA     250  6.3   76     6  24          0.5
-#> 56     NA     135  8.0   75     6  25          0.5
-#> 57     NA     127  8.0   78     6  26          0.5
-#> 58     NA      47 10.3   73     6  27          0.5
-#> 59     NA      98 11.5   80     6  28          0.5
-#> 60     NA      31 14.9   77     6  29          0.5
-#> 61     NA     138  8.0   83     6  30          0.5
-#> 62    135     269  4.1   84     7   1          0.0
-#> 63     49     248  9.2   85     7   2          0.0
-#> 64     32     236  9.2   81     7   3          0.0
-#> 65     NA     101 10.9   84     7   4          0.5
-#> 66     64     175  4.6   83     7   5          0.0
-#> 67     40     314 10.9   83     7   6          0.0
-#> 68     77     276  5.1   88     7   7          0.0
-#> 69     97     267  6.3   92     7   8          0.0
-#> 70     97     272  5.7   92     7   9          0.0
-#> 71     85     175  7.4   89     7  10          0.0
-#> 72     NA     139  8.6   82     7  11          0.5
-#> 73     10     264 14.3   73     7  12          0.0
-#> 74     27     175 14.9   81     7  13          0.0
-#> 75     NA     291 14.9   91     7  14          0.5
-#> 76      7      48 14.3   80     7  15          0.0
-#> 77     48     260  6.9   81     7  16          0.0
-#> 78     35     274 10.3   82     7  17          0.0
-#> 79     61     285  6.3   84     7  18          0.0
-#> 80     79     187  5.1   87     7  19          0.0
-#> 81     63     220 11.5   85     7  20          0.0
-#> 82     16       7  6.9   74     7  21          0.0
-#> 83     NA     258  9.7   81     7  22          0.5
-#> 84     NA     295 11.5   82     7  23          0.5
-#> 85     80     294  8.6   86     7  24          0.0
-#> 86    108     223  8.0   85     7  25          0.0
-#> 87     20      81  8.6   82     7  26          0.0
-#> 88     52      82 12.0   86     7  27          0.0
-#> 89     82     213  7.4   88     7  28          0.0
-#> 90     50     275  7.4   86     7  29          0.0
-#> 91     64     253  7.4   83     7  30          0.0
-#> 92     59     254  9.2   81     7  31          0.0
-#> 93     39      83  6.9   81     8   1          0.0
-#> 94      9      24 13.8   81     8   2          0.0
-#> 95     16      77  7.4   82     8   3          0.0
-#> 96     78      NA  6.9   86     8   4          0.5
-#> 97     35      NA  7.4   85     8   5          0.5
-#> 98     66      NA  4.6   87     8   6          0.5
-#> 99    122     255  4.0   89     8   7          0.0
-#> 100    89     229 10.3   90     8   8          0.0
-#> 101   110     207  8.0   90     8   9          0.0
-#> 102    NA     222  8.6   92     8  10          0.5
-#> 103    NA     137 11.5   86     8  11          0.5
-#> 104    44     192 11.5   86     8  12          0.0
-#> 105    28     273 11.5   82     8  13          0.0
-#> 106    65     157  9.7   80     8  14          0.0
-#> 107    NA      64 11.5   79     8  15          0.5
-#> 108    22      71 10.3   77     8  16          0.0
-#> 109    59      51  6.3   79     8  17          0.0
-#> 110    23     115  7.4   76     8  18          0.0
-#> 111    31     244 10.9   78     8  19          0.0
-#> 112    44     190 10.3   78     8  20          0.0
-#> 113    21     259 15.5   77     8  21          0.0
-#> 114     9      36 14.3   72     8  22          0.0
-#> 115    NA     255 12.6   75     8  23          0.5
-#> 116    45     212  9.7   79     8  24          0.0
-#> 117   168     238  3.4   81     8  25          0.0
-#> 118    73     215  8.0   86     8  26          0.0
-#> 119    NA     153  5.7   88     8  27          0.5
-#> 120    76     203  9.7   97     8  28          0.0
-#> 121   118     225  2.3   94     8  29          0.0
-#> 122    84     237  6.3   96     8  30          0.0
-#> 123    85     188  6.3   94     8  31          0.0
-#> 124    96     167  6.9   91     9   1          0.0
-#> 125    78     197  5.1   92     9   2          0.0
-#> 126    73     183  2.8   93     9   3          0.0
-#> 127    91     189  4.6   93     9   4          0.0
-#> 128    47      95  7.4   87     9   5          0.0
-#> 129    32      92 15.5   84     9   6          0.0
-#> 130    20     252 10.9   80     9   7          0.0
-#> 131    23     220 10.3   78     9   8          0.0
-#> 132    21     230 10.9   75     9   9          0.0
-#> 133    24     259  9.7   73     9  10          0.0
-#> 134    44     236 14.9   81     9  11          0.0
-#> 135    21     259 15.5   76     9  12          0.0
-#> 136    28     238  6.3   77     9  13          0.0
-#> 137     9      24 10.9   71     9  14          0.0
-#> 138    13     112 11.5   71     9  15          0.0
-#> 139    46     237  6.9   78     9  16          0.0
-#> 140    18     224 13.8   67     9  17          0.0
-#> 141    13      27 10.3   76     9  18          0.0
-#> 142    24     238 10.3   68     9  19          0.0
-#> 143    16     201  8.0   82     9  20          0.0
-#> 144    13     238 12.6   64     9  21          0.0
-#> 145    23      14  9.2   71     9  22          0.0
-#> 146    36     139 10.3   81     9  23          0.0
-#> 147     7      49 10.3   69     9  24          0.0
-#> 148    14      20 16.6   63     9  25          0.0
-#> 149    30     193  6.9   70     9  26          0.0
-#> 150    NA     145 13.2   77     9  27          0.5
-#> 151    14     191 14.3   75     9  28          0.0
-#> 152    18     131  8.0   76     9  29          0.0
-#> 153    20     223 11.5   68     9  30          0.0
-
-# this can be applied to model the proportion of missing data
-# as in Tierney et al \doi{10.1136/bmjopen-2014-007450}
-# see "Modelling missingness" in vignette "Getting Started with naniar"
-# for details
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/add_shadow.html b/docs/reference/add_shadow.html deleted file mode 100644 index 8730ad13..00000000 --- a/docs/reference/add_shadow.html +++ /dev/null @@ -1,154 +0,0 @@ - -Add a shadow column to dataframe — add_shadow • naniar - Skip to contents - - -
-
-
- -
-

As an alternative to bind_shadow(), you can add specific individual shadow -columns to a dataset. These also respect the dplyr verbs -starts_with, contains, ends_with, etc.

-
- -
-

Usage

-
add_shadow(data, ...)
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

One or more unquoted variable names, separated by commas. These also -respect the dplyr verbs starts_with, contains, ends_with, etc.

- -
-
-

Value

- - -

data.frame

-
- - -
-

Examples

-

-airquality %>% add_shadow(Ozone)
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA
-#>    <int>   <int> <dbl> <int> <int> <int> <fct>   
-#>  1    41     190   7.4    67     5     1 !NA     
-#>  2    36     118   8      72     5     2 !NA     
-#>  3    12     149  12.6    74     5     3 !NA     
-#>  4    18     313  11.5    62     5     4 !NA     
-#>  5    NA      NA  14.3    56     5     5 NA      
-#>  6    28      NA  14.9    66     5     6 !NA     
-#>  7    23     299   8.6    65     5     7 !NA     
-#>  8    19      99  13.8    59     5     8 !NA     
-#>  9     8      19  20.1    61     5     9 !NA     
-#> 10    NA     194   8.6    69     5    10 NA      
-#> # ℹ 143 more rows
-airquality %>% add_shadow(Ozone, Solar.R)
-#> # A tibble: 153 × 8
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA
-#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>     
-#>  1    41     190   7.4    67     5     1 !NA      !NA       
-#>  2    36     118   8      72     5     2 !NA      !NA       
-#>  3    12     149  12.6    74     5     3 !NA      !NA       
-#>  4    18     313  11.5    62     5     4 !NA      !NA       
-#>  5    NA      NA  14.3    56     5     5 NA       NA        
-#>  6    28      NA  14.9    66     5     6 !NA      NA        
-#>  7    23     299   8.6    65     5     7 !NA      !NA       
-#>  8    19      99  13.8    59     5     8 !NA      !NA       
-#>  9     8      19  20.1    61     5     9 !NA      !NA       
-#> 10    NA     194   8.6    69     5    10 NA       !NA       
-#> # ℹ 143 more rows
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/add_shadow_shift.html b/docs/reference/add_shadow_shift.html deleted file mode 100644 index 152e7292..00000000 --- a/docs/reference/add_shadow_shift.html +++ /dev/null @@ -1,145 +0,0 @@ - -Add a shadow shifted column to a dataset — add_shadow_shift • naniar - Skip to contents - - -
-
-
- -
-

Shadow shift missing values using only the selected variables in a dataset, -by specifying variable names or use dplyr vars and dplyr verbs -starts_with, contains, ends_with, etc.

-
- -
-

Usage

-
add_shadow_shift(data, ..., suffix = "shift")
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

One or more unquoted variable names separated by commas. These also -respect the dplyr verbs starts_with, contains, ends_with, etc.

- - -
suffix
-

suffix to add to variable, defaults to "shift"

- -
-
-

Value

- - -

data with the added variable shifted named as var_suffix

- - -
- - -
-

Examples

-

-airquality %>% add_shadow_shift(Ozone, Solar.R)
-#> # A tibble: 153 × 8
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_shift Solar.R_shift
-#>    <int>   <int> <dbl> <int> <int> <int>       <dbl>         <dbl>
-#>  1    41     190   7.4    67     5     1        41           190  
-#>  2    36     118   8      72     5     2        36           118  
-#>  3    12     149  12.6    74     5     3        12           149  
-#>  4    18     313  11.5    62     5     4        18           313  
-#>  5    NA      NA  14.3    56     5     5       -19.7         -33.6
-#>  6    28      NA  14.9    66     5     6        28           -33.1
-#>  7    23     299   8.6    65     5     7        23           299  
-#>  8    19      99  13.8    59     5     8        19            99  
-#>  9     8      19  20.1    61     5     9         8            19  
-#> 10    NA     194   8.6    69     5    10       -18.5         194  
-#> # ℹ 143 more rows
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/add_span_counter.html b/docs/reference/add_span_counter.html deleted file mode 100644 index b69b88d4..00000000 --- a/docs/reference/add_span_counter.html +++ /dev/null @@ -1,117 +0,0 @@ - -Add a counter variable for a span of dataframe — add_span_counter • naniar - Skip to contents - - -
-
-
- -
-

Adds a variable, span_counter to a dataframe. Used internally to facilitate -counting of missing values over a given span.

-
- -
-

Usage

-
add_span_counter(data, span_size)
-
- -
-

Arguments

-
data
-

data.frame

- - -
span_size
-

integer

- -
-
-

Value

- - -

data.frame with extra variable "span_counter".

-
- -
-

Examples

-
if (FALSE) {
-# add_span_counter(pedestrian, span_size = 100)
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/all-is-miss-complete.html b/docs/reference/all-is-miss-complete.html deleted file mode 100644 index ee170868..00000000 --- a/docs/reference/all-is-miss-complete.html +++ /dev/null @@ -1,123 +0,0 @@ - -Identify if all values are missing or complete — all-is-miss-complete • naniar - Skip to contents - - -
-
-
- -
-

This is shorthand for all(is.na(x)) and all(!is.na(x))

-
- -
-

Usage

-
all_na(x)
-
-all_miss(x)
-
-all_complete(x)
-
- -
-

Arguments

-
x
-

an R object to be tested.

- -
- -
-

Examples

-

-misses <- c(NA, NA, NA)
-complete <- c(1, 2, 3)
-mixture <- c(NA, 1, NA)
-
-all_na(misses)
-#> [1] TRUE
-all_na(complete)
-#> [1] FALSE
-all_na(mixture)
-#> [1] FALSE
-all_complete(misses)
-#> [1] FALSE
-all_complete(complete)
-#> [1] TRUE
-all_complete(mixture)
-#> [1] FALSE
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/all_row_complete.html b/docs/reference/all_row_complete.html deleted file mode 100644 index 7c0b6b25..00000000 --- a/docs/reference/all_row_complete.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - -Helper function to determine whether all rows are complete — all_row_complete • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Helper function to determine whether all rows are complete

- -
- -
all_row_complete(x)
- -

Arguments

- - - - - - -
x

a vector

- -

Value

- -

logical vector

- - -
- -
- -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - - - - diff --git a/docs/reference/all_row_miss.html b/docs/reference/all_row_miss.html deleted file mode 100644 index 837cdd45..00000000 --- a/docs/reference/all_row_miss.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - -Helper function to determine whether all rows are missing — all_row_miss • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Helper function to determine whether all rows are missing

- -
- -
all_row_miss(x)
- -

Arguments

- - - - - - -
x

a vector

- -

Value

- -

logical vector

- - -
- -
- -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - - - - diff --git a/docs/reference/any-na.html b/docs/reference/any-na.html deleted file mode 100644 index 65248ed1..00000000 --- a/docs/reference/any-na.html +++ /dev/null @@ -1,129 +0,0 @@ - -Identify if there are any missing or complete values — any-na • naniar - Skip to contents - - -
-
-
- -
-

It is useful to search for any instances of missing or complete values. There -Are two functions that do this in naniar - any_miss and it's alias -any_na. These bother under the hood call anyNA. any_complete is -the complement to any_miss - it returns TRUE if there are any complete values.

-
- -
-

Usage

-
any_na(x)
-
-any_miss(x)
-
-any_complete(x)
-
- -
-

Arguments

-
x
-

an R object to be tested

- -
-
-

See also

- -
- -
-

Examples

-

-anyNA(airquality)
-#> [1] TRUE
-any_na(airquality)
-#> [1] TRUE
-any_miss(airquality)
-#> [1] TRUE
-any_complete(airquality)
-#> [1] TRUE
-
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/any_row_miss.html b/docs/reference/any_row_miss.html deleted file mode 100644 index 1c0931ed..00000000 --- a/docs/reference/any_row_miss.html +++ /dev/null @@ -1,103 +0,0 @@ - -Helper function to determine whether there are any missings — any_row_miss • naniar - Skip to contents - - -
-
-
- -
-

Helper function to determine whether there are any missings

-
- -
-

Usage

-
any_row_miss(x)
-
- -
-

Arguments

-
x
-

a vector

- -
-
-

Value

- - -

logical vector TRUE = missing FALSE = complete

-
- -
- - -
- - - - - - - diff --git a/docs/reference/are_shadow.html b/docs/reference/are_shadow.html deleted file mode 100644 index e03c0ea0..00000000 --- a/docs/reference/are_shadow.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - -Are these things shadows? — are_shadow • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Does this thing contain a shadow variable?

- -
- -
are_shadow(x)
- -

Arguments

- - - - - - -
x

vector or data.frame

- -

Value

- -

logical vector - TRUE if contains a variable with a column ending in "_NA"

- - -

Examples

-
-df_shadow <- bind_shadow(airquality) - -are_shadow(df_shadow)
#> [1] FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - - - - diff --git a/docs/reference/as_shadow.data.frame.html b/docs/reference/as_shadow.data.frame.html deleted file mode 100644 index fd3aafc5..00000000 --- a/docs/reference/as_shadow.data.frame.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - -Create shadow data — as_shadow.data.frame • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Return a tibble in shadow matrix form, where the variables are the same but -have a suffix _NA attached to distinguish them.

-
- -
# S3 method for data.frame
-as_shadow(data, ...)
- -

Arguments

- - - - - - - - - - -
data

dataframe

...

selected variables to use

- - -

Examples

-
-as_shadow(airquality)
#> # A tibble: 153 x 6 -#> Ozone_NA Solar.R_NA Wind_NA Temp_NA Month_NA Day_NA -#> <fct> <fct> <fct> <fct> <fct> <fct> -#> 1 !NA !NA !NA !NA !NA !NA -#> 2 !NA !NA !NA !NA !NA !NA -#> 3 !NA !NA !NA !NA !NA !NA -#> 4 !NA !NA !NA !NA !NA !NA -#> 5 NA NA !NA !NA !NA !NA -#> 6 !NA NA !NA !NA !NA !NA -#> 7 !NA !NA !NA !NA !NA !NA -#> 8 !NA !NA !NA !NA !NA !NA -#> 9 !NA !NA !NA !NA !NA !NA -#> 10 NA !NA !NA !NA !NA !NA -#> # … with 143 more rows
-
-
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/as_shadow.html b/docs/reference/as_shadow.html deleted file mode 100644 index 7ebc514e..00000000 --- a/docs/reference/as_shadow.html +++ /dev/null @@ -1,139 +0,0 @@ - -Create shadows — as_shadow • naniar - Skip to contents - - -
-
-
- -
-

Return a tibble in shadow matrix form, where the variables are the same but -have a suffix _NA attached to distinguish them.

-
- -
-

Usage

-
as_shadow(data, ...)
-
- -
-

Arguments

-
data
-

dataframe

- - -
...
-

selected variables to use

- -
-
-

Value

- - -

appended shadow with column names

-
-
-

Details

-

Representing missing data structure is achieved using the shadow matrix, -introduced in Swayne and Buja. The shadow -matrix is the same dimension as the data, and consists of binary indicators -of missingness of data values, where missing is represented as "NA", and not -missing is represented as "!NA". Although these may be represented as 1 and -0, respectively.

-
- -
-

Examples

-

-as_shadow(airquality)
-#> # A tibble: 153 × 6
-#>    Ozone_NA Solar.R_NA Wind_NA Temp_NA Month_NA Day_NA
-#>    <fct>    <fct>      <fct>   <fct>   <fct>    <fct> 
-#>  1 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  2 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  3 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  4 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  5 NA       NA         !NA     !NA     !NA      !NA   
-#>  6 !NA      NA         !NA     !NA     !NA      !NA   
-#>  7 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  8 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  9 !NA      !NA        !NA     !NA     !NA      !NA   
-#> 10 NA       !NA        !NA     !NA     !NA      !NA   
-#> # ℹ 143 more rows
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/as_shadow_upset.html b/docs/reference/as_shadow_upset.html deleted file mode 100644 index 18b76ed1..00000000 --- a/docs/reference/as_shadow_upset.html +++ /dev/null @@ -1,119 +0,0 @@ - -Convert data into shadow format for doing an upset plot — as_shadow_upset • naniar - Skip to contents - - -
-
-
- -
-

Upset plots are a way of visualising common sets, this function transforms -the data into a format that feeds directly into an upset plot

-
- -
-

Usage

-
as_shadow_upset(data)
-
- -
-

Arguments

-
data
-

a data.frame

- -
-
-

Value

- - -

a data.frame

-
- -
-

Examples

-

-if (FALSE) {
-
-library(UpSetR)
-airquality %>%
-  as_shadow_upset() %>%
-  upset()
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/bind_shadow-1.png b/docs/reference/bind_shadow-1.png deleted file mode 100644 index 8cfeafb6..00000000 Binary files a/docs/reference/bind_shadow-1.png and /dev/null differ diff --git a/docs/reference/bind_shadow-2.png b/docs/reference/bind_shadow-2.png deleted file mode 100644 index a4196617..00000000 Binary files a/docs/reference/bind_shadow-2.png and /dev/null differ diff --git a/docs/reference/bind_shadow-3.png b/docs/reference/bind_shadow-3.png deleted file mode 100644 index fd6e98d6..00000000 Binary files a/docs/reference/bind_shadow-3.png and /dev/null differ diff --git a/docs/reference/bind_shadow-4.png b/docs/reference/bind_shadow-4.png deleted file mode 100644 index fd6e98d6..00000000 Binary files a/docs/reference/bind_shadow-4.png and /dev/null differ diff --git a/docs/reference/bind_shadow-5.png b/docs/reference/bind_shadow-5.png deleted file mode 100644 index fd6e98d6..00000000 Binary files a/docs/reference/bind_shadow-5.png and /dev/null differ diff --git a/docs/reference/bind_shadow-6.png b/docs/reference/bind_shadow-6.png deleted file mode 100644 index fd6e98d6..00000000 Binary files a/docs/reference/bind_shadow-6.png and /dev/null differ diff --git a/docs/reference/bind_shadow-7.png b/docs/reference/bind_shadow-7.png deleted file mode 100644 index fd6e98d6..00000000 Binary files a/docs/reference/bind_shadow-7.png and /dev/null differ diff --git a/docs/reference/bind_shadow-8.png b/docs/reference/bind_shadow-8.png deleted file mode 100644 index fd6e98d6..00000000 Binary files a/docs/reference/bind_shadow-8.png and /dev/null differ diff --git a/docs/reference/bind_shadow-9.png b/docs/reference/bind_shadow-9.png deleted file mode 100644 index fd6e98d6..00000000 Binary files a/docs/reference/bind_shadow-9.png and /dev/null differ diff --git a/docs/reference/bind_shadow.html b/docs/reference/bind_shadow.html deleted file mode 100644 index 745eee09..00000000 --- a/docs/reference/bind_shadow.html +++ /dev/null @@ -1,174 +0,0 @@ - -Bind a shadow dataframe to original data — bind_shadow • naniar - Skip to contents - - -
-
-
- -
-

Binding a shadow matrix to a regular dataframe helps visualise and work with -missing data.

-
- -
-

Usage

-
bind_shadow(data, only_miss = FALSE, ...)
-
- -
-

Arguments

-
data
-

a dataframe

- - -
only_miss
-

logical - if FALSE (default) it will bind a dataframe with -all of the variables duplicated with their shadow. Setting this to TRUE -will bind variables only those variables that contain missing values. -See the examples for more details.

- - -
...
-

extra options to pass to recode_shadow() - a work in progress.

- -
-
-

Value

- - -

data with the added variable shifted and the suffix _NA

- - -
- -
-

Examples

-

-bind_shadow(airquality)
-#> # A tibble: 153 × 12
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA Wind_NA Temp_NA
-#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>      <fct>   <fct>  
-#>  1    41     190   7.4    67     5     1 !NA      !NA        !NA     !NA    
-#>  2    36     118   8      72     5     2 !NA      !NA        !NA     !NA    
-#>  3    12     149  12.6    74     5     3 !NA      !NA        !NA     !NA    
-#>  4    18     313  11.5    62     5     4 !NA      !NA        !NA     !NA    
-#>  5    NA      NA  14.3    56     5     5 NA       NA         !NA     !NA    
-#>  6    28      NA  14.9    66     5     6 !NA      NA         !NA     !NA    
-#>  7    23     299   8.6    65     5     7 !NA      !NA        !NA     !NA    
-#>  8    19      99  13.8    59     5     8 !NA      !NA        !NA     !NA    
-#>  9     8      19  20.1    61     5     9 !NA      !NA        !NA     !NA    
-#> 10    NA     194   8.6    69     5    10 NA       !NA        !NA     !NA    
-#> # ℹ 143 more rows
-#> # ℹ 2 more variables: Month_NA <fct>, Day_NA <fct>
-
-# bind only the variables that contain missing values
-bind_shadow(airquality, only_miss = TRUE)
-#> # A tibble: 153 × 8
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA
-#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>     
-#>  1    41     190   7.4    67     5     1 !NA      !NA       
-#>  2    36     118   8      72     5     2 !NA      !NA       
-#>  3    12     149  12.6    74     5     3 !NA      !NA       
-#>  4    18     313  11.5    62     5     4 !NA      !NA       
-#>  5    NA      NA  14.3    56     5     5 NA       NA        
-#>  6    28      NA  14.9    66     5     6 !NA      NA        
-#>  7    23     299   8.6    65     5     7 !NA      !NA       
-#>  8    19      99  13.8    59     5     8 !NA      !NA       
-#>  9     8      19  20.1    61     5     9 !NA      !NA       
-#> 10    NA     194   8.6    69     5    10 NA       !NA       
-#> # ℹ 143 more rows
-
-aq_shadow <- bind_shadow(airquality)
-
-if (FALSE) {
-# explore missing data visually
-library(ggplot2)
-
-# using the bounded shadow to visualise Ozone according to whether Solar
-# Radiation is missing or not.
-
-ggplot(data = aq_shadow,
-       aes(x = Ozone)) +
-       geom_histogram() +
-       facet_wrap(~Solar.R_NA,
-       ncol = 1)
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/brfss.html b/docs/reference/brfss.html deleted file mode 100644 index c92c826d..00000000 --- a/docs/reference/brfss.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - -The Behavioral Risk Factor Surveillance System (BRFSS) Survey -Data, 2009. — brfss • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

The data is a subset of the 2009 survey from BRFSS, an ongoing -data collection program designed to measure behavioral risk -factors for the adult population (18 years of age or older) living -in households.

- - -
data(brfss)
- -

Source

- -

http://www.cdc.gov/BRFSS/technical_infodata/surveydata/2009.htm

- -

Details

- -

Also see the codebook: -http://ftp.cdc.gov/pub/data/brfss/codebook_09.rtf

-

Format: a data frame with 245 observations on the following 34 -variables.

-
SEX

A factor with levels Male Female.

-
AGE

A numeric vector from 7 to 97.

-
HISPANC2

A factor with levels Yes No -corresponding to the question: are you Hispanic or Latino?

-
VETERAN2

A factor with levels 1 2 -3 4 5. The question for this variable is: -Have you ever served on active duty in the United States Armed -Forces, either in the regular military or in a National Guard or -military reserve unit? Active duty does not include training for -the Reserves or National Guard, but DOES include activation, for -example, for the Persian Gulf War. And the labels are meaning: 1: -Yes, now on active duty; 2: Yes, on active duty during the last 12 -months, but not now; 3: Yes, on active duty in the past, but not -during the last 12 months; 4: No, training for Reserves or -National Guard only; 5: No, never served in the military.

-
MARITAL

A factor with levels Married -Divorced Widowed Separated -NeverMarried UnmarriedCouple.

-
CHILDREN

A numeric vector giving the number of -children less than 18 years of age in household.

-
EDUCA

A factor with the education levels 1 -2 3 4 5 6 as 1: Never attended -school or only kindergarten; 2: Grades 1 through 8 (Elementary); -3: Grades 9 through 11 (Some high school); 4: Grade 12 or GED -(High school graduate); 5: College 1 year to 3 years (Some college -or technical school); 6: College 4 years or more (College -graduate).

-
EMPLOY

A factor showing the employment -status with levels 1 2 3 4 5 -7 8. The labels mean -- 1: Employed for wages; 2: -Self-employed; 3: Out of work for more than 1 year; 4: Out of -work for less that 1 year; 5: A homemaker; 6: A student; 7: -Retired; 8: Unable to work.

-
INCOME2

The annual household income from all sources with levels <10k 10-15k 15-20k 20-25k 25-35k 35-50k 50-75k >75k Dontknow Refused.

WEIGHT2

The weight without shoes in pounds.

-
HEIGHT3

The weight without shoes in inches.

-
PREGNANT

Whether pregnant now with two -levels Yes and No.

GENHLTH

The -answer to the question "in general your health is" with levels -Excellent VeryGood Good Fair -Poor Refused.

-
PHYSHLTH

The number of -days during the last 30 days that the respondent's physical health -was not good. -7 is for "Don't know/Not sure", and -9 is for -"Refused".

-
MENTHLTH

The number of days during the -last 30 days that the respondent's mental health was not good. -7 -is for "Don't know/Not sure", and -9 is for "Refused".

-
POORHLTH

The number of days during the last 30 days -that poor physical or mental health keep the respondent from doing -usual activities, such as self-care, work, or recreation. -7 is -for "Don't know/Not sure", and -9 is for "Refused".

-
HLTHPLAN

Whether having any kind of health care -coverage, including health insurance, prepaid plans such as HMOs, -or government plans such as Medicare. The answer has two levels: -Yes and No.

-
CAREGIVE

Whether -providing any such care or assistance to a friend or family member -during the past month, with levels Yes and No.

-
QLACTLM2

Whether being limited in any way in any -activities because of physical, mental, or emotional problems, -with levels Yes and No.

-
DRNKANY4

Whether having had at least one drink of -any alcoholic beverage such as beer, wine, a malt beverage or -liquor during the past 30 days, with levels Yes and -No.

-
ALCDAY4

The number of days during the -past 30 days that the respondent had at least one drink of any -alcoholic beverage. -7 is for "Don't know/Not sure", and -9 is -for "Refused".

-
AVEDRNK2

The number of drinks on the -average the respondent had on the days when he/she drank, during -the past 30 days. -7 is for "Don't know/Not sure", and -9 is for -"Refused".

-
SMOKE100

Whether having smoked at least -100 cigarettes in the entire life, with levels Yes and -No.

-
SMOKDAY2

The frequency of days now -smoking, with levels Everyday Somedays and -NotAtAll(not at all).

-
STOPSMK2

Whether -having stopped smoking for one day or longer during the past 12 -months because the respondent was trying to quit smoking, with -levels Yes and No.

-
LASTSMK1

A factor -with levels 3 4 5 6 7 8 -corresponding to the question: how long has it been since last -smokeing cigarettes regularly? The labels mean: 3: Within the past -6 months (3 months but less than 6 months ago); 4: Within the past -year (6 months but less than 1 year ago); 5: Within the past 5 -years (1 year but less than 5 years ago); 6: Within the past 10 -years (5 years but less than 10 years ago); 7: 10 years or more; -8: Never smoked regularly.

-
FRUIT

The number of -fruit the respondent eat every year, not counting juice. -7 is for -"Don't know/Not sure", and -9 is for "Refused".

-
GREENSAL

The number of servings of green salad the -respondent eat every year. -7 is for "Don't know/Not sure", -and -9 is for "Refused".

-
POTATOES

The number of -servings of potatoes, not including french fries, fried potatoes, -or potato chips, that the respondent eat every year. -7 is for -"Don't know/Not sure", and -9 is for "Refused".

-
CARROTS

The number of carrots the respondent eat -every year. -7 is for "Don't know/Not sure", and -9 is for -"Refused".

-
VEGETABL

The number of servings of -vegetables the respondent eat every year, not counting carrots, -potatoes, or salad. -7 is for "Don't know/Not sure", and -9 is -for "Refused".

-
FRUITJUI

The number of fruit juices -such as orange, grapefruit, or tomato that the respondent drink -every year. -7 is for "Don't know/Not sure", and -9 is for -"Refused".

-
BMI4

Body Mass Index (BMI). Computed by -WEIGHT in Kilograms/(HEIGHT in Meters * HEIGHT3 in Meters). -Missing if any of WEIGHT2 or HEIGHT3 is missing.

- -

See also

- -

library(MissingDataGUI)

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/cast_shadow-1.png b/docs/reference/cast_shadow-1.png deleted file mode 100644 index db022156..00000000 Binary files a/docs/reference/cast_shadow-1.png and /dev/null differ diff --git a/docs/reference/cast_shadow.html b/docs/reference/cast_shadow.html deleted file mode 100644 index 24363a1d..00000000 --- a/docs/reference/cast_shadow.html +++ /dev/null @@ -1,165 +0,0 @@ - -Add a shadow column to a dataset — cast_shadow • naniar - Skip to contents - - -
-
-
- -
-

Casting a shadow shifted column performs the equivalent pattern to -data %>% select(var) %>% shadow_shift(). This is a convenience function -that makes it easy to perform certain visualisations, in line with the -principle that the user should have a way to flexibly return data formats -containing information about the missing data. It forms the base building -block for the functions cast_shadow_shift, and cast_shadow_shift_label. -It also respects the dplyr verbs starts_with, contains, ends_with, etc. -to select variables.

-
- -
-

Usage

-
cast_shadow(data, ...)
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

One or more unquoted variable names separated by commas. These -respect the dplyr verbs starts_with, contains, ends_with, etc.

- -
-
-

Value

- - -

data with the added variable shifted and the suffix _NA

- - -
- - -
-

Examples

-

-airquality %>% cast_shadow(Ozone, Solar.R)
-#> # A tibble: 153 × 4
-#>    Ozone Solar.R Ozone_NA Solar.R_NA
-#>    <int>   <int> <fct>    <fct>     
-#>  1    41     190 !NA      !NA       
-#>  2    36     118 !NA      !NA       
-#>  3    12     149 !NA      !NA       
-#>  4    18     313 !NA      !NA       
-#>  5    NA      NA NA       NA        
-#>  6    28      NA !NA      NA        
-#>  7    23     299 !NA      !NA       
-#>  8    19      99 !NA      !NA       
-#>  9     8      19 !NA      !NA       
-#> 10    NA     194 NA       !NA       
-#> # ℹ 143 more rows
-if (FALSE) {
-library(ggplot2)
-library(magrittr)
-airquality  %>%
-  cast_shadow(Ozone,Solar.R) %>%
-  ggplot(aes(x = Ozone,
-             colour = Solar.R_NA)) +
-        geom_density()
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/cast_shadow_shift.html b/docs/reference/cast_shadow_shift.html deleted file mode 100644 index d182c322..00000000 --- a/docs/reference/cast_shadow_shift.html +++ /dev/null @@ -1,158 +0,0 @@ - -Add a shadow and a shadow_shift column to a dataset — cast_shadow_shift • naniar - Skip to contents - - -
-
-
- -
-

Shift the values and add a shadow column. It also respects the dplyr -verbs starts_with, contains, ends_with, etc.

-
- -
-

Usage

-
cast_shadow_shift(data, ...)
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

One or more unquoted variable names separated by commas. These -respect the dplyr verbs starts_with, contains, ends_with, etc.

- -
-
-

Value

- - -

data.frame with the shadow and shadow_shift vars

-
- - -
-

Examples

-

-airquality %>% cast_shadow_shift(Ozone,Temp)
-#> # A tibble: 153 × 6
-#>    Ozone  Temp Ozone_NA Temp_NA Ozone_shift Temp_shift
-#>    <int> <int> <fct>    <fct>         <dbl>      <int>
-#>  1    41    67 !NA      !NA            41           67
-#>  2    36    72 !NA      !NA            36           72
-#>  3    12    74 !NA      !NA            12           74
-#>  4    18    62 !NA      !NA            18           62
-#>  5    NA    56 NA       !NA           -19.7         56
-#>  6    28    66 !NA      !NA            28           66
-#>  7    23    65 !NA      !NA            23           65
-#>  8    19    59 !NA      !NA            19           59
-#>  9     8    61 !NA      !NA             8           61
-#> 10    NA    69 NA       !NA           -18.5         69
-#> # ℹ 143 more rows
-
-airquality %>% cast_shadow_shift(dplyr::contains("o"))
-#> Warning: `fct_explicit_na()` was deprecated in forcats 1.0.0.
-#>  Please use `fct_na_value_to_level()` instead.
-#>  The deprecated feature was likely used in the naniar package.
-#>   Please report the issue at <https://github.com/njtierney/naniar/issues>.
-#> # A tibble: 153 × 12
-#>    Ozone Solar.R Month Ozone_NA Solar.R_NA Month_NA Ozone_shift Solar.R_shift
-#>    <int>   <int> <int> <fct>    <fct>      <fct>          <dbl>         <dbl>
-#>  1    41     190     5 !NA      !NA        !NA             41           190  
-#>  2    36     118     5 !NA      !NA        !NA             36           118  
-#>  3    12     149     5 !NA      !NA        !NA             12           149  
-#>  4    18     313     5 !NA      !NA        !NA             18           313  
-#>  5    NA      NA     5 NA       NA         !NA            -19.7         -33.6
-#>  6    28      NA     5 !NA      NA         !NA             28           -33.1
-#>  7    23     299     5 !NA      !NA        !NA             23           299  
-#>  8    19      99     5 !NA      !NA        !NA             19            99  
-#>  9     8      19     5 !NA      !NA        !NA              8            19  
-#> 10    NA     194     5 NA       !NA        !NA            -18.5         194  
-#> # ℹ 143 more rows
-#> # ℹ 4 more variables: Month_shift <int>, Ozone_NA_shift <fct>,
-#> #   Solar.R_NA_shift <fct>, Month_NA_shift <fct>
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/cast_shadow_shift_label-1.png b/docs/reference/cast_shadow_shift_label-1.png deleted file mode 100644 index b022a457..00000000 Binary files a/docs/reference/cast_shadow_shift_label-1.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label-2.png b/docs/reference/cast_shadow_shift_label-2.png deleted file mode 100644 index 70aa4b8c..00000000 Binary files a/docs/reference/cast_shadow_shift_label-2.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label-3.png b/docs/reference/cast_shadow_shift_label-3.png deleted file mode 100644 index 64541042..00000000 Binary files a/docs/reference/cast_shadow_shift_label-3.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label-4.png b/docs/reference/cast_shadow_shift_label-4.png deleted file mode 100644 index 64541042..00000000 Binary files a/docs/reference/cast_shadow_shift_label-4.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label-5.png b/docs/reference/cast_shadow_shift_label-5.png deleted file mode 100644 index 64541042..00000000 Binary files a/docs/reference/cast_shadow_shift_label-5.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label-6.png b/docs/reference/cast_shadow_shift_label-6.png deleted file mode 100644 index 64541042..00000000 Binary files a/docs/reference/cast_shadow_shift_label-6.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label-7.png b/docs/reference/cast_shadow_shift_label-7.png deleted file mode 100644 index 64541042..00000000 Binary files a/docs/reference/cast_shadow_shift_label-7.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label-8.png b/docs/reference/cast_shadow_shift_label-8.png deleted file mode 100644 index 64541042..00000000 Binary files a/docs/reference/cast_shadow_shift_label-8.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label-9.png b/docs/reference/cast_shadow_shift_label-9.png deleted file mode 100644 index 64541042..00000000 Binary files a/docs/reference/cast_shadow_shift_label-9.png and /dev/null differ diff --git a/docs/reference/cast_shadow_shift_label.html b/docs/reference/cast_shadow_shift_label.html deleted file mode 100644 index 6b68fcdb..00000000 --- a/docs/reference/cast_shadow_shift_label.html +++ /dev/null @@ -1,145 +0,0 @@ - -Add a shadow column and a shadow shifted column to a dataset — cast_shadow_shift_label • naniar - Skip to contents - - -
-
-
- -
-

Shift the values, add shadow, add missing label

-
- -
-

Usage

-
cast_shadow_shift_label(data, ...)
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

One or more unquoted expressions separated by commas. These also -respect the dplyr verbs "starts_with", "contains", "ends_with", etc.

- -
-
-

Value

- - -

data.frame with the shadow and shadow_shift vars, and missing labels

-
- - -
-

Examples

-

-airquality %>% cast_shadow_shift_label(Ozone, Solar.R)
-#> # A tibble: 153 × 7
-#>    Ozone Solar.R Ozone_NA Solar.R_NA Ozone_shift Solar.R_shift any_missing
-#>    <int>   <int> <fct>    <fct>            <dbl>         <dbl> <chr>      
-#>  1    41     190 !NA      !NA               41           190   Not Missing
-#>  2    36     118 !NA      !NA               36           118   Not Missing
-#>  3    12     149 !NA      !NA               12           149   Not Missing
-#>  4    18     313 !NA      !NA               18           313   Not Missing
-#>  5    NA      NA NA       NA               -19.7         -33.6 Missing    
-#>  6    28      NA !NA      NA                28           -33.1 Missing    
-#>  7    23     299 !NA      !NA               23           299   Not Missing
-#>  8    19      99 !NA      !NA               19            99   Not Missing
-#>  9     8      19 !NA      !NA                8            19   Not Missing
-#> 10    NA     194 NA       !NA              -18.5         194   Missing    
-#> # ℹ 143 more rows
-
-# replicate the plot generated by geom_miss_point()
-if (FALSE) {
-library(ggplot2)
-
-airquality %>%
-  cast_shadow_shift_label(Ozone,Solar.R) %>%
-  ggplot(aes(x = Ozone_shift,
-             y = Solar.R_shift,
-             colour = any_missing)) +
-        geom_point()
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/common_na_numbers.html b/docs/reference/common_na_numbers.html deleted file mode 100644 index 260e1b93..00000000 --- a/docs/reference/common_na_numbers.html +++ /dev/null @@ -1,152 +0,0 @@ - -Common number values for NA — common_na_numbers • naniar - Skip to contents - - -
-
-
- -
-

This vector contains common number values of NA (missing), which is aimed to -be used inside naniar functions miss_scan_count() and -replace_with_na(). The current list of numbers can be found by printing -out common_na_numbers. It is a useful way to explore your data for -possible missings, but I strongly warn against using this to replace NA -values without very carefully looking at the incidence for each of the -cases. Common NA strings are in the data object common_na_strings.

-
- -
-

Usage

-
common_na_numbers
-
- -
-

Format

-

An object of class numeric of length 8.

-
-
-

Note

-

original discussion here https://github.com/njtierney/naniar/issues/168

-
- -
-

Examples

-

-dat_ms <- tibble::tribble(~x,  ~y,    ~z,
-                          1,   "A",   -100,
-                          3,   "N/A", -99,
-                          NA,  NA,    -98,
-                          -99, "E",   -101,
-                          -98, "F",   -1)
-
-miss_scan_count(dat_ms, -99)
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            1
-#> 2 y            0
-#> 3 z            1
-miss_scan_count(dat_ms, c("-99","-98","N/A"))
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            2
-#> 2 y            1
-#> 3 z            2
-common_na_numbers
-#> [1]    -9   -99  -999 -9999  9999    66    77    88
-miss_scan_count(dat_ms, common_na_numbers)
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            2
-#> 2 y            0
-#> 3 z            2
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/common_na_strings.html b/docs/reference/common_na_strings.html deleted file mode 100644 index ffd7e64f..00000000 --- a/docs/reference/common_na_strings.html +++ /dev/null @@ -1,173 +0,0 @@ - -Common string values for NA — common_na_strings • naniar - Skip to contents - - -
-
-
- -
-

This vector contains common values of NA (missing), which is aimed to -be used inside naniar functions miss_scan_count() and -replace_with_na(). The current list of -strings used can be found by printing out common_na_strings. It is a -useful way to explore your data for possible missings, but I strongly warn -against using this to replace NA values without very carefully looking at -the incidence for each of the cases. Please note that common_na_strings -uses \\ around the "?", "." and "*" characters to protect against using -their wildcard features in grep. Common NA numbers are in the data object -common_na_numbers.

-
- -
-

Usage

-
common_na_strings
-
- -
-

Format

-

An object of class character of length 26.

-
-
-

Note

-

original discussion here https://github.com/njtierney/naniar/issues/168

-
- -
-

Examples

-

-dat_ms <- tibble::tribble(~x,  ~y,    ~z,
-                          1,   "A",   -100,
-                          3,   "N/A", -99,
-                          NA,  NA,    -98,
-                          -99, "E",   -101,
-                          -98, "F",   -1)
-
-miss_scan_count(dat_ms, -99)
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            1
-#> 2 y            0
-#> 3 z            1
-miss_scan_count(dat_ms, c("-99","-98","N/A"))
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            2
-#> 2 y            1
-#> 3 z            2
-common_na_strings
-#>  [1] "missing" "NA"      "N A"     "N/A"     "#N/A"    "NA "     " NA"    
-#>  [8] "N /A"    "N / A"   " N / A"  "N / A "  "na"      "n a"     "n/a"    
-#> [15] "na "     " na"     "n /a"    "n / a"   " a / a"  "n / a "  "NULL"   
-#> [22] "null"    ""        "\\?"     "\\*"     "\\."    
-miss_scan_count(dat_ms, common_na_strings)
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            4
-#> 2 y            4
-#> 3 z            5
-replace_with_na(dat_ms, replace = list(y = common_na_strings))
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 NA      -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/draw_key.html b/docs/reference/draw_key.html deleted file mode 100644 index 32cfafe0..00000000 --- a/docs/reference/draw_key.html +++ /dev/null @@ -1,115 +0,0 @@ - -Key drawing functions — draw_key • naniar - Skip to contents - - -
-
-
- -
-

Each Geom has an associated function that draws the key when the geom needs -to be displayed in a legend. These are the options built into naniar.

-
- -
-

Usage

-
draw_key_missing_point(data, params, size)
-
- -
-

Arguments

-
data
-

A single row data frame containing the scaled aesthetics to -display in this key

- - -
params
-

A list of additional parameters supplied to the geom.

- - -
size
-

Width and height of key in mm.

- -
-
-

Value

- - -

A grid grob.

-
- -
- - -
- - - - - - - diff --git a/docs/reference/figures/README-facet-by-month-1.png b/docs/reference/figures/README-facet-by-month-1.png deleted file mode 100644 index 46d54056..00000000 Binary files a/docs/reference/figures/README-facet-by-month-1.png and /dev/null differ diff --git a/docs/reference/figures/README-geom-miss-point-1.png b/docs/reference/figures/README-geom-miss-point-1.png deleted file mode 100644 index f52572cf..00000000 Binary files a/docs/reference/figures/README-geom-miss-point-1.png and /dev/null differ diff --git a/docs/reference/figures/README-geom-missing-point-1.png b/docs/reference/figures/README-geom-missing-point-1.png deleted file mode 100644 index 6d42633e..00000000 Binary files a/docs/reference/figures/README-geom-missing-point-1.png and /dev/null differ diff --git a/docs/reference/figures/README-gg-miss-span-1.png b/docs/reference/figures/README-gg-miss-span-1.png deleted file mode 100644 index 1c8852f3..00000000 Binary files a/docs/reference/figures/README-gg-miss-span-1.png and /dev/null differ diff --git a/docs/reference/figures/README-gg-miss-upset-1.png b/docs/reference/figures/README-gg-miss-upset-1.png deleted file mode 100644 index b29d3a90..00000000 Binary files a/docs/reference/figures/README-gg-miss-upset-1.png and /dev/null differ diff --git a/docs/reference/figures/README-gg-miss-var-1.png b/docs/reference/figures/README-gg-miss-var-1.png deleted file mode 100644 index 2961b2f6..00000000 Binary files a/docs/reference/figures/README-gg-miss-var-1.png and /dev/null differ diff --git a/docs/reference/figures/README-gg-missing-var-1.png b/docs/reference/figures/README-gg-missing-var-1.png deleted file mode 100644 index 82e18cd2..00000000 Binary files a/docs/reference/figures/README-gg-missing-var-1.png and /dev/null differ diff --git a/docs/reference/figures/README-regular-geom-point-1.png b/docs/reference/figures/README-regular-geom-point-1.png deleted file mode 100644 index bc6f0d86..00000000 Binary files a/docs/reference/figures/README-regular-geom-point-1.png and /dev/null differ diff --git a/docs/reference/figures/README-shadow-impute-1.png b/docs/reference/figures/README-shadow-impute-1.png deleted file mode 100644 index d29d7bc2..00000000 Binary files a/docs/reference/figures/README-shadow-impute-1.png and /dev/null differ diff --git a/docs/reference/figures/README-shadow-w-ggplot-1.png b/docs/reference/figures/README-shadow-w-ggplot-1.png deleted file mode 100644 index 898346c3..00000000 Binary files a/docs/reference/figures/README-shadow-w-ggplot-1.png and /dev/null differ diff --git a/docs/reference/figures/README-unnamed-chunk-3-1.png b/docs/reference/figures/README-unnamed-chunk-3-1.png deleted file mode 100644 index 38708df6..00000000 Binary files a/docs/reference/figures/README-unnamed-chunk-3-1.png and /dev/null differ diff --git a/docs/reference/figures/README-unnamed-chunk-4-1.png b/docs/reference/figures/README-unnamed-chunk-4-1.png deleted file mode 100644 index bf416b6b..00000000 Binary files a/docs/reference/figures/README-unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/reference/figures/README-unnamed-chunk-5-1.png b/docs/reference/figures/README-unnamed-chunk-5-1.png deleted file mode 100644 index 502bc205..00000000 Binary files a/docs/reference/figures/README-unnamed-chunk-5-1.png and /dev/null differ diff --git a/docs/reference/figures/README-upset-plot-1.png b/docs/reference/figures/README-upset-plot-1.png deleted file mode 100644 index b33b74d4..00000000 Binary files a/docs/reference/figures/README-upset-plot-1.png and /dev/null differ diff --git a/docs/reference/figures/logo.png b/docs/reference/figures/logo.png deleted file mode 100644 index 8cbb9981..00000000 Binary files a/docs/reference/figures/logo.png and /dev/null differ diff --git a/docs/reference/figures/naniar-logo.png b/docs/reference/figures/naniar-logo.png deleted file mode 100644 index f1a601c5..00000000 Binary files a/docs/reference/figures/naniar-logo.png and /dev/null differ diff --git a/docs/reference/gather_shadow.html b/docs/reference/gather_shadow.html deleted file mode 100644 index 9f393d0d..00000000 --- a/docs/reference/gather_shadow.html +++ /dev/null @@ -1,130 +0,0 @@ - -Long form representation of a shadow matrix — gather_shadow • naniar - Skip to contents - - -
-
-
- -
-

gather_shadow is a long-form representation of binding the shadow matrix to -your data, producing variables named case, variable, and missing, where -missing contains the missing value representation.

-
- -
-

Usage

-
gather_shadow(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

dataframe in long, format, containing information about the missings

-
- -
-

Examples

-

-gather_shadow(airquality)
-#> # A tibble: 918 × 3
-#>     case variable   missing
-#>    <int> <chr>      <fct>  
-#>  1     1 Ozone_NA   !NA    
-#>  2     1 Solar.R_NA !NA    
-#>  3     1 Wind_NA    !NA    
-#>  4     1 Temp_NA    !NA    
-#>  5     1 Month_NA   !NA    
-#>  6     1 Day_NA     !NA    
-#>  7     2 Ozone_NA   !NA    
-#>  8     2 Solar.R_NA !NA    
-#>  9     2 Wind_NA    !NA    
-#> 10     2 Temp_NA    !NA    
-#> # ℹ 908 more rows
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/geom_miss_point-1.png b/docs/reference/geom_miss_point-1.png deleted file mode 100644 index a4fe08f2..00000000 Binary files a/docs/reference/geom_miss_point-1.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-10.png b/docs/reference/geom_miss_point-10.png deleted file mode 100644 index 2ad0e441..00000000 Binary files a/docs/reference/geom_miss_point-10.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-11.png b/docs/reference/geom_miss_point-11.png deleted file mode 100644 index 989edeb3..00000000 Binary files a/docs/reference/geom_miss_point-11.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-12.png b/docs/reference/geom_miss_point-12.png deleted file mode 100644 index 2ad0e441..00000000 Binary files a/docs/reference/geom_miss_point-12.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-13.png b/docs/reference/geom_miss_point-13.png deleted file mode 100644 index 989edeb3..00000000 Binary files a/docs/reference/geom_miss_point-13.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-14.png b/docs/reference/geom_miss_point-14.png deleted file mode 100644 index 2ad0e441..00000000 Binary files a/docs/reference/geom_miss_point-14.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-15.png b/docs/reference/geom_miss_point-15.png deleted file mode 100644 index 989edeb3..00000000 Binary files a/docs/reference/geom_miss_point-15.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-16.png b/docs/reference/geom_miss_point-16.png deleted file mode 100644 index 2ad0e441..00000000 Binary files a/docs/reference/geom_miss_point-16.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-17.png b/docs/reference/geom_miss_point-17.png deleted file mode 100644 index 989edeb3..00000000 Binary files a/docs/reference/geom_miss_point-17.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-18.png b/docs/reference/geom_miss_point-18.png deleted file mode 100644 index 2ad0e441..00000000 Binary files a/docs/reference/geom_miss_point-18.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-2.png b/docs/reference/geom_miss_point-2.png deleted file mode 100644 index 7cc54b8b..00000000 Binary files a/docs/reference/geom_miss_point-2.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-3.png b/docs/reference/geom_miss_point-3.png deleted file mode 100644 index 3a3212ec..00000000 Binary files a/docs/reference/geom_miss_point-3.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-4.png b/docs/reference/geom_miss_point-4.png deleted file mode 100644 index 93cec92a..00000000 Binary files a/docs/reference/geom_miss_point-4.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-5.png b/docs/reference/geom_miss_point-5.png deleted file mode 100644 index 989edeb3..00000000 Binary files a/docs/reference/geom_miss_point-5.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-6.png b/docs/reference/geom_miss_point-6.png deleted file mode 100644 index 2ad0e441..00000000 Binary files a/docs/reference/geom_miss_point-6.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-7.png b/docs/reference/geom_miss_point-7.png deleted file mode 100644 index 989edeb3..00000000 Binary files a/docs/reference/geom_miss_point-7.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-8.png b/docs/reference/geom_miss_point-8.png deleted file mode 100644 index 2ad0e441..00000000 Binary files a/docs/reference/geom_miss_point-8.png and /dev/null differ diff --git a/docs/reference/geom_miss_point-9.png b/docs/reference/geom_miss_point-9.png deleted file mode 100644 index 989edeb3..00000000 Binary files a/docs/reference/geom_miss_point-9.png and /dev/null differ diff --git a/docs/reference/geom_miss_point.html b/docs/reference/geom_miss_point.html deleted file mode 100644 index e8c7e53c..00000000 --- a/docs/reference/geom_miss_point.html +++ /dev/null @@ -1,215 +0,0 @@ - -geom_miss_point — geom_miss_point • naniar - Skip to contents - - -
-
-
- -
-

geom_miss_point provides a way to transform and plot missing -values in ggplot2. To do so it uses methods from ggobi to display missing -data points 10\ -the same axis.

-
- -
-

Usage

-
geom_miss_point(
-  mapping = NULL,
-  data = NULL,
-  prop_below = 0.1,
-  jitter = 0.05,
-  stat = "miss_point",
-  position = "identity",
-  colour = ..missing..,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE,
-  ...
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by ggplot2::aes() -or ggplot2::aes_(). If specified and inherit.aes = TRUE -(the default), is combined with the default mapping at the top level of the -plot. You only need to supply mapping if there isn't a mapping defined for -the plot.

- - -
data
-

A data frame. If specified, overrides the default data frame -defined at the top level of the plot.

- - -
prop_below
-

the degree to shift the values. The default is 0.1

- - -
jitter
-

the amount of jitter to add. The default is 0.05

- - -
stat
-

The statistical transformation to use on the data for this layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of a -call to a position adjustment function.

- - -
colour
-

the colour chosen for the aesthetic

- - -
na.rm
-

If FALSE (the default), removes missing values with a -warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. FALSE -never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, rather -than combining with them. This is most useful for helper functions that -define both data and aesthetics and shouldn't inherit behaviour from the -default plot specification, e.g. borders.

- - -
...
-

other arguments passed on to ggplot2::layer(). There -are three types of arguments you can use here:

  • Aesthetics: to set an aesthetic to a fixed value, like -color = "red" or size = 3.

  • -
  • Other arguments to the layer, for example you override the default -stat associated with the layer.

  • -
  • Other arguments passed on to the stat.

  • -
- -
-
-

Details

-

Plot Missing Data Points

-
-
-

Note

-

Warning message if na.rm = T is supplied.

-
-
-

See also

-

[gg_miss_case()][gg_miss_case_cumsum()][gg_miss_fct()][gg_miss_span()][gg_miss_var()][gg_miss_var_cumsum()][gg_miss_which()]

-
- -
-

Examples

-
if (FALSE) {
-library(ggplot2)
-
-# using regular geom_point()
-ggplot(airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
-geom_point()
-
-# using  geom_miss_point()
-ggplot(airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
- geom_miss_point()
-
- # using facets
-
-ggplot(airquality,
-       aes(x = Ozone,
-           y = Solar.R)) +
- geom_miss_point() +
- facet_wrap(~Month)
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/geom_missing_point-3.png b/docs/reference/geom_missing_point-3.png deleted file mode 100644 index a6fac5d9..00000000 Binary files a/docs/reference/geom_missing_point-3.png and /dev/null differ diff --git a/docs/reference/geom_missing_point-5.png b/docs/reference/geom_missing_point-5.png deleted file mode 100644 index f9622f13..00000000 Binary files a/docs/reference/geom_missing_point-5.png and /dev/null differ diff --git a/docs/reference/geom_missing_point.html b/docs/reference/geom_missing_point.html deleted file mode 100644 index 03165ff6..00000000 --- a/docs/reference/geom_missing_point.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - -geom_missing_point — geom_missing_point • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Plot Missing Data Points

- - -
geom_missing_point(mapping = NULL, data = NULL, position = "identity",
-  colour = ..missing.., na.rm = FALSE, show.legend = NA,
-  inherit.aes = TRUE, ...)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mapping

Set of aesthetic mappings created by aes -or aes_. If specified and inherit.aes = TRUE -(the default), is combined with the default mapping at the top level of the -plot. You only need to supply mapping if there isn't a mapping defined for -the plot.

data

A data frame. If specified, overrides the default data frame -defined at the top level of the plot.

position

Position adjustment, either as a string, or the result of a -call to a position adjustment function.

colour

the colour chosen for the aesthetic

na.rm

If FALSE (the default), removes missing values with a -warning. If TRUE silently removes missing values.

show.legend

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. FALSE -never includes, and TRUE always includes.

inherit.aes

If FALSE, overrides the default aesthetics, rather -than combining with them. This is most useful for helper functions that -define both data and aesthetics and shouldn't inherit behaviour from the -default plot specification, e.g. borders.

...

other arguments passed on to layer. There -are three types of arguments you can use here:

    -
  • Aesthetics: to set an aesthetic to a fixed value, like - color = "red" or size = 3.

  • -
  • Other arguments to the layer, for example you override the default - stat associated with the layer.

  • -
  • Other arguments passed on to the stat.

  • -
- -

Details

- -

geom_missing_point adds a missing data point geometry to ggplot2. This displays missing data points 10

- -

Note

- -

Warning message if na.rm = T is supplied.

- - -

Examples

-
-library(ggplot2) - -# using regular geom_point() -ggplot(airquality, - aes(x = Ozone, - y = Solar.R)) + -geom_point()
#> Warning: Removed 42 rows containing missing values (geom_point).
-# using geom_missing_point() -ggplot(airquality, - aes(x = Ozone, - y = Solar.R)) + -geom_missing_point()
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/gg_miss_case-1.png b/docs/reference/gg_miss_case-1.png deleted file mode 100644 index f12a7163..00000000 Binary files a/docs/reference/gg_miss_case-1.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-10.png b/docs/reference/gg_miss_case-10.png deleted file mode 100644 index 6c403598..00000000 Binary files a/docs/reference/gg_miss_case-10.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-11.png b/docs/reference/gg_miss_case-11.png deleted file mode 100644 index c0ad777f..00000000 Binary files a/docs/reference/gg_miss_case-11.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-12.png b/docs/reference/gg_miss_case-12.png deleted file mode 100644 index 6c403598..00000000 Binary files a/docs/reference/gg_miss_case-12.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-13.png b/docs/reference/gg_miss_case-13.png deleted file mode 100644 index c0ad777f..00000000 Binary files a/docs/reference/gg_miss_case-13.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-14.png b/docs/reference/gg_miss_case-14.png deleted file mode 100644 index 6c403598..00000000 Binary files a/docs/reference/gg_miss_case-14.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-15.png b/docs/reference/gg_miss_case-15.png deleted file mode 100644 index c0ad777f..00000000 Binary files a/docs/reference/gg_miss_case-15.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-16.png b/docs/reference/gg_miss_case-16.png deleted file mode 100644 index 6c403598..00000000 Binary files a/docs/reference/gg_miss_case-16.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-17.png b/docs/reference/gg_miss_case-17.png deleted file mode 100644 index c0ad777f..00000000 Binary files a/docs/reference/gg_miss_case-17.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-18.png b/docs/reference/gg_miss_case-18.png deleted file mode 100644 index 6c403598..00000000 Binary files a/docs/reference/gg_miss_case-18.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-2.png b/docs/reference/gg_miss_case-2.png deleted file mode 100644 index 78669eaa..00000000 Binary files a/docs/reference/gg_miss_case-2.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-3.png b/docs/reference/gg_miss_case-3.png deleted file mode 100644 index 18159b2c..00000000 Binary files a/docs/reference/gg_miss_case-3.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-4.png b/docs/reference/gg_miss_case-4.png deleted file mode 100644 index 29637d8f..00000000 Binary files a/docs/reference/gg_miss_case-4.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-5.png b/docs/reference/gg_miss_case-5.png deleted file mode 100644 index a68ffd8d..00000000 Binary files a/docs/reference/gg_miss_case-5.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-6.png b/docs/reference/gg_miss_case-6.png deleted file mode 100644 index 13cfd99b..00000000 Binary files a/docs/reference/gg_miss_case-6.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-7.png b/docs/reference/gg_miss_case-7.png deleted file mode 100644 index 28bab287..00000000 Binary files a/docs/reference/gg_miss_case-7.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-8.png b/docs/reference/gg_miss_case-8.png deleted file mode 100644 index 6c403598..00000000 Binary files a/docs/reference/gg_miss_case-8.png and /dev/null differ diff --git a/docs/reference/gg_miss_case-9.png b/docs/reference/gg_miss_case-9.png deleted file mode 100644 index c0ad777f..00000000 Binary files a/docs/reference/gg_miss_case-9.png and /dev/null differ diff --git a/docs/reference/gg_miss_case.html b/docs/reference/gg_miss_case.html deleted file mode 100644 index f6cd2378..00000000 --- a/docs/reference/gg_miss_case.html +++ /dev/null @@ -1,142 +0,0 @@ - -Plot the number of missings per case (row) — gg_miss_case • naniar - Skip to contents - - -
-
-
- -
-

This is a visual analogue to miss_case_summary. It draws a ggplot of the -number of missings in each case (row). A default minimal theme is used, which -can be customised as normal for ggplot.

-
- -
-

Usage

-
gg_miss_case(x, facet, order_cases = TRUE, show_pct = FALSE)
-
- -
-

Arguments

-
x
-

data.frame

- - -
facet
-

(optional) a single bare variable name, if you want to create a faceted plot.

- - -
order_cases
-

logical Order the rows by missingness (default is FALSE - -no order).

- - -
show_pct
-

logical Show the percentage of cases

- -
-
-

Value

- - -

a ggplot object depicting the number of missings in a given case.

-
- - -
-

Examples

-

-gg_miss_case(airquality)
-
-if (FALSE) {
-library(ggplot2)
-gg_miss_case(airquality) + labs(x = "Number of Cases")
-gg_miss_case(airquality, show_pct = TRUE)
-gg_miss_case(airquality, order_cases = FALSE)
-gg_miss_case(airquality, facet = Month)
-gg_miss_case(airquality, facet = Month, order_cases = FALSE)
-gg_miss_case(airquality, facet = Month, show_pct = TRUE)
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/gg_miss_case_cumsum-1.png b/docs/reference/gg_miss_case_cumsum-1.png deleted file mode 100644 index d4c981c1..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-1.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-10.png b/docs/reference/gg_miss_case_cumsum-10.png deleted file mode 100644 index 7bbfcb91..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-10.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-11.png b/docs/reference/gg_miss_case_cumsum-11.png deleted file mode 100644 index 8ae841a9..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-11.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-12.png b/docs/reference/gg_miss_case_cumsum-12.png deleted file mode 100644 index 7bbfcb91..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-12.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-13.png b/docs/reference/gg_miss_case_cumsum-13.png deleted file mode 100644 index 8ae841a9..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-13.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-14.png b/docs/reference/gg_miss_case_cumsum-14.png deleted file mode 100644 index 7bbfcb91..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-14.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-15.png b/docs/reference/gg_miss_case_cumsum-15.png deleted file mode 100644 index 8ae841a9..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-15.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-16.png b/docs/reference/gg_miss_case_cumsum-16.png deleted file mode 100644 index 7bbfcb91..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-16.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-17.png b/docs/reference/gg_miss_case_cumsum-17.png deleted file mode 100644 index 8ae841a9..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-17.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-18.png b/docs/reference/gg_miss_case_cumsum-18.png deleted file mode 100644 index 7bbfcb91..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-18.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-2.png b/docs/reference/gg_miss_case_cumsum-2.png deleted file mode 100644 index 8de21e94..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-2.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-3.png b/docs/reference/gg_miss_case_cumsum-3.png deleted file mode 100644 index c1fcff6c..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-3.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-4.png b/docs/reference/gg_miss_case_cumsum-4.png deleted file mode 100644 index e0495e69..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-4.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-5.png b/docs/reference/gg_miss_case_cumsum-5.png deleted file mode 100644 index 8ae841a9..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-5.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-6.png b/docs/reference/gg_miss_case_cumsum-6.png deleted file mode 100644 index 7bbfcb91..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-6.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-7.png b/docs/reference/gg_miss_case_cumsum-7.png deleted file mode 100644 index 8ae841a9..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-7.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-8.png b/docs/reference/gg_miss_case_cumsum-8.png deleted file mode 100644 index f1e339ab..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-8.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum-9.png b/docs/reference/gg_miss_case_cumsum-9.png deleted file mode 100644 index 8ae841a9..00000000 Binary files a/docs/reference/gg_miss_case_cumsum-9.png and /dev/null differ diff --git a/docs/reference/gg_miss_case_cumsum.html b/docs/reference/gg_miss_case_cumsum.html deleted file mode 100644 index 78a9d0af..00000000 --- a/docs/reference/gg_miss_case_cumsum.html +++ /dev/null @@ -1,124 +0,0 @@ - -Plot of cumulative sum of missing for cases — gg_miss_case_cumsum • naniar - Skip to contents - - -
-
-
- -
-

A plot showing the cumulative sum of missing values for cases, reading the -rows from the top to bottom. A default minimal theme is used, which can be -customised as normal for ggplot.

-
- -
-

Usage

-
gg_miss_case_cumsum(x, breaks = 20)
-
- -
-

Arguments

-
x
-

a dataframe

- - -
breaks
-

the breaks for the x axis default is 20

- -
-
-

Value

- - -

a ggplot object depicting the number of missings

-
- - -
-

Examples

-

-gg_miss_case_cumsum(airquality)
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/gg_miss_fct-1.png b/docs/reference/gg_miss_fct-1.png deleted file mode 100644 index fe409fa9..00000000 Binary files a/docs/reference/gg_miss_fct-1.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-10.png b/docs/reference/gg_miss_fct-10.png deleted file mode 100644 index 459b9752..00000000 Binary files a/docs/reference/gg_miss_fct-10.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-11.png b/docs/reference/gg_miss_fct-11.png deleted file mode 100644 index 2eb3dfc2..00000000 Binary files a/docs/reference/gg_miss_fct-11.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-12.png b/docs/reference/gg_miss_fct-12.png deleted file mode 100644 index 459b9752..00000000 Binary files a/docs/reference/gg_miss_fct-12.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-13.png b/docs/reference/gg_miss_fct-13.png deleted file mode 100644 index 2eb3dfc2..00000000 Binary files a/docs/reference/gg_miss_fct-13.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-14.png b/docs/reference/gg_miss_fct-14.png deleted file mode 100644 index 459b9752..00000000 Binary files a/docs/reference/gg_miss_fct-14.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-15.png b/docs/reference/gg_miss_fct-15.png deleted file mode 100644 index 2eb3dfc2..00000000 Binary files a/docs/reference/gg_miss_fct-15.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-16.png b/docs/reference/gg_miss_fct-16.png deleted file mode 100644 index 459b9752..00000000 Binary files a/docs/reference/gg_miss_fct-16.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-17.png b/docs/reference/gg_miss_fct-17.png deleted file mode 100644 index 2eb3dfc2..00000000 Binary files a/docs/reference/gg_miss_fct-17.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-18.png b/docs/reference/gg_miss_fct-18.png deleted file mode 100644 index 459b9752..00000000 Binary files a/docs/reference/gg_miss_fct-18.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-2.png b/docs/reference/gg_miss_fct-2.png deleted file mode 100644 index 0e1ff766..00000000 Binary files a/docs/reference/gg_miss_fct-2.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-3.png b/docs/reference/gg_miss_fct-3.png deleted file mode 100644 index 495af8fa..00000000 Binary files a/docs/reference/gg_miss_fct-3.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-4.png b/docs/reference/gg_miss_fct-4.png deleted file mode 100644 index bb7ee7d3..00000000 Binary files a/docs/reference/gg_miss_fct-4.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-5.png b/docs/reference/gg_miss_fct-5.png deleted file mode 100644 index 4d2b5fe7..00000000 Binary files a/docs/reference/gg_miss_fct-5.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-6.png b/docs/reference/gg_miss_fct-6.png deleted file mode 100644 index a3551a74..00000000 Binary files a/docs/reference/gg_miss_fct-6.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-7.png b/docs/reference/gg_miss_fct-7.png deleted file mode 100644 index 2eb3dfc2..00000000 Binary files a/docs/reference/gg_miss_fct-7.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-8.png b/docs/reference/gg_miss_fct-8.png deleted file mode 100644 index 459b9752..00000000 Binary files a/docs/reference/gg_miss_fct-8.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct-9.png b/docs/reference/gg_miss_fct-9.png deleted file mode 100644 index 2eb3dfc2..00000000 Binary files a/docs/reference/gg_miss_fct-9.png and /dev/null differ diff --git a/docs/reference/gg_miss_fct.html b/docs/reference/gg_miss_fct.html deleted file mode 100644 index b99dab61..00000000 --- a/docs/reference/gg_miss_fct.html +++ /dev/null @@ -1,130 +0,0 @@ - -Plot the number of missings for each variable, broken down by a factor — gg_miss_fct • naniar - Skip to contents - - -
-
-
- -
-

This function draws a ggplot plot of the number of missings in each column, -broken down by a categorical variable from the dataset. A default minimal -theme is used, which can be customised as normal for ggplot.

-
- -
-

Usage

-
gg_miss_fct(x, fct)
-
- -
-

Arguments

-
x
-

data.frame

- - -
fct
-

column containing the factor variable to visualise

- -
-
-

Value

- - -

ggplot object depicting the % missing of each factor level for -each variable.

-
- - -
-

Examples

-

-gg_miss_fct(x = riskfactors, fct = marital)
-
-if (FALSE) {
-library(ggplot2)
-gg_miss_fct(x = riskfactors, fct = marital) + labs(title = "NA in Risk Factors and Marital status")
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/gg_miss_span-1.png b/docs/reference/gg_miss_span-1.png deleted file mode 100644 index db510c94..00000000 Binary files a/docs/reference/gg_miss_span-1.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-10.png b/docs/reference/gg_miss_span-10.png deleted file mode 100644 index 5b4c1500..00000000 Binary files a/docs/reference/gg_miss_span-10.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-11.png b/docs/reference/gg_miss_span-11.png deleted file mode 100644 index 34d92448..00000000 Binary files a/docs/reference/gg_miss_span-11.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-12.png b/docs/reference/gg_miss_span-12.png deleted file mode 100644 index c6cadd3e..00000000 Binary files a/docs/reference/gg_miss_span-12.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-13.png b/docs/reference/gg_miss_span-13.png deleted file mode 100644 index 5b4c1500..00000000 Binary files a/docs/reference/gg_miss_span-13.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-14.png b/docs/reference/gg_miss_span-14.png deleted file mode 100644 index 34d92448..00000000 Binary files a/docs/reference/gg_miss_span-14.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-15.png b/docs/reference/gg_miss_span-15.png deleted file mode 100644 index c6cadd3e..00000000 Binary files a/docs/reference/gg_miss_span-15.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-16.png b/docs/reference/gg_miss_span-16.png deleted file mode 100644 index 5b4c1500..00000000 Binary files a/docs/reference/gg_miss_span-16.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-17.png b/docs/reference/gg_miss_span-17.png deleted file mode 100644 index 34d92448..00000000 Binary files a/docs/reference/gg_miss_span-17.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-18.png b/docs/reference/gg_miss_span-18.png deleted file mode 100644 index c6cadd3e..00000000 Binary files a/docs/reference/gg_miss_span-18.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-19.png b/docs/reference/gg_miss_span-19.png deleted file mode 100644 index 5b4c1500..00000000 Binary files a/docs/reference/gg_miss_span-19.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-2.png b/docs/reference/gg_miss_span-2.png deleted file mode 100644 index ccc5072e..00000000 Binary files a/docs/reference/gg_miss_span-2.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-20.png b/docs/reference/gg_miss_span-20.png deleted file mode 100644 index 34d92448..00000000 Binary files a/docs/reference/gg_miss_span-20.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-21.png b/docs/reference/gg_miss_span-21.png deleted file mode 100644 index c6cadd3e..00000000 Binary files a/docs/reference/gg_miss_span-21.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-22.png b/docs/reference/gg_miss_span-22.png deleted file mode 100644 index 5b4c1500..00000000 Binary files a/docs/reference/gg_miss_span-22.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-23.png b/docs/reference/gg_miss_span-23.png deleted file mode 100644 index 34d92448..00000000 Binary files a/docs/reference/gg_miss_span-23.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-24.png b/docs/reference/gg_miss_span-24.png deleted file mode 100644 index c6cadd3e..00000000 Binary files a/docs/reference/gg_miss_span-24.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-25.png b/docs/reference/gg_miss_span-25.png deleted file mode 100644 index 5b4c1500..00000000 Binary files a/docs/reference/gg_miss_span-25.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-26.png b/docs/reference/gg_miss_span-26.png deleted file mode 100644 index 34d92448..00000000 Binary files a/docs/reference/gg_miss_span-26.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-27.png b/docs/reference/gg_miss_span-27.png deleted file mode 100644 index c6cadd3e..00000000 Binary files a/docs/reference/gg_miss_span-27.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-3.png b/docs/reference/gg_miss_span-3.png deleted file mode 100644 index dded3dc9..00000000 Binary files a/docs/reference/gg_miss_span-3.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-379.png b/docs/reference/gg_miss_span-379.png deleted file mode 100644 index 578bb0c0..00000000 Binary files a/docs/reference/gg_miss_span-379.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-4.png b/docs/reference/gg_miss_span-4.png deleted file mode 100644 index 0e96ed18..00000000 Binary files a/docs/reference/gg_miss_span-4.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-5.png b/docs/reference/gg_miss_span-5.png deleted file mode 100644 index ccc5072e..00000000 Binary files a/docs/reference/gg_miss_span-5.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-6.png b/docs/reference/gg_miss_span-6.png deleted file mode 100644 index 0c6e083f..00000000 Binary files a/docs/reference/gg_miss_span-6.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-7.png b/docs/reference/gg_miss_span-7.png deleted file mode 100644 index 5b4c1500..00000000 Binary files a/docs/reference/gg_miss_span-7.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-8.png b/docs/reference/gg_miss_span-8.png deleted file mode 100644 index 34d92448..00000000 Binary files a/docs/reference/gg_miss_span-8.png and /dev/null differ diff --git a/docs/reference/gg_miss_span-9.png b/docs/reference/gg_miss_span-9.png deleted file mode 100644 index c6cadd3e..00000000 Binary files a/docs/reference/gg_miss_span-9.png and /dev/null differ diff --git a/docs/reference/gg_miss_span.html b/docs/reference/gg_miss_span.html deleted file mode 100644 index 1bb3106f..00000000 --- a/docs/reference/gg_miss_span.html +++ /dev/null @@ -1,158 +0,0 @@ - -Plot the number of missings in a given repeating span — gg_miss_span • naniar - Skip to contents - - -
-
-
- -
-

gg_miss_span is a replacement function to -imputeTS::plotNA.distributionBar(tsNH4, breaksize = 100), which shows the -number of missings in a given span, or breaksize. A default minimal theme -is used, which can be customised as normal for ggplot.

-
- -
-

Usage

-
gg_miss_span(data, var, span_every, facet)
-
- -
-

Arguments

-
data
-

data.frame

- - -
var
-

a bare unquoted variable name from data.

- - -
span_every
-

integer describing the length of the span to be explored

- - -
facet
-

(optional) a single bare variable name, if you want to create a faceted plot.

- -
-
-

Value

- - -

ggplot2 showing the number of missings in a span (window, or breaksize)

-
- - -
-

Examples

-

-miss_var_span(pedestrian, hourly_counts, span_every = 3000)
-#> # A tibble: 13 × 6
-#>    span_counter n_miss n_complete prop_miss prop_complete n_in_span
-#>           <int>  <int>      <int>     <dbl>         <dbl>     <int>
-#>  1            1      0       3000  0                1          3000
-#>  2            2      0       3000  0                1          3000
-#>  3            3      1       2999  0.000333         1.00       3000
-#>  4            4    121       2879  0.0403           0.960      3000
-#>  5            5    503       2497  0.168            0.832      3000
-#>  6            6    555       2445  0.185            0.815      3000
-#>  7            7    190       2810  0.0633           0.937      3000
-#>  8            8      0       3000  0                1          3000
-#>  9            9      1       2999  0.000333         1.00       3000
-#> 10           10      0       3000  0                1          3000
-#> 11           11      0       3000  0                1          3000
-#> 12           12    745       2255  0.248            0.752      3000
-#> 13           13    432       1268  0.254            0.746      1700
-if (FALSE) {
-library(ggplot2)
-gg_miss_span(pedestrian, hourly_counts, span_every = 3000)
-gg_miss_span(pedestrian, hourly_counts, span_every = 3000, facet = sensor_name)
-# works with the rest of ggplot
-gg_miss_span(pedestrian, hourly_counts, span_every = 3000) + labs(x = "custom")
-gg_miss_span(pedestrian, hourly_counts, span_every = 3000) + theme_dark()
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/gg_miss_upset.html b/docs/reference/gg_miss_upset.html deleted file mode 100644 index 52932b08..00000000 --- a/docs/reference/gg_miss_upset.html +++ /dev/null @@ -1,149 +0,0 @@ - -Plot the pattern of missingness using an upset plot. — gg_miss_upset • naniar - Skip to contents - - -
-
-
- -
-

Upset plots are a way of visualising common sets, gg_miss_upset shows the -number of missing values for each of the sets of data. The default option -of gg_miss_upset is taken from UpSetR::upset - which is to use up to 5 -sets and up to 40 interactions. We also set the ordering to by the -frequency of the intersections. Setting nsets = 5 means to look at 5 -variables and their combinations. The number of combinations or rather -intersections is controlled by nintersects. If there are 40 -intersections, there will be 40 combinations of variables explored. The -number of sets and intersections can be changed by passing arguments nsets = 10 to look at 10 sets of variables, and nintersects = 50 to look at 50 -intersections.

-
- -
-

Usage

-
gg_miss_upset(data, order.by = "freq", ...)
-
- -
-

Arguments

-
data
-

data.frame

- - -
order.by
-

(from UpSetR::upset) How the intersections in the matrix should be ordered by. Options include frequency (entered as "freq"), degree, or both in any order. See ?UpSetR::upset for more options

- - -
...
-

arguments to pass to upset plot - see ?UpSetR::upset

- -
-
-

Value

- - -

a ggplot visualisation of missing data

-
- -
-

Examples

-

-if (FALSE) {
-gg_miss_upset(airquality)
-gg_miss_upset(riskfactors)
-gg_miss_upset(riskfactors, nsets = 10)
-gg_miss_upset(riskfactors, nsets = 10, nintersects = 10)
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/gg_miss_var-1.png b/docs/reference/gg_miss_var-1.png deleted file mode 100644 index ee30e571..00000000 Binary files a/docs/reference/gg_miss_var-1.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-10.png b/docs/reference/gg_miss_var-10.png deleted file mode 100644 index fabca968..00000000 Binary files a/docs/reference/gg_miss_var-10.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-11.png b/docs/reference/gg_miss_var-11.png deleted file mode 100644 index 2bc0aaed..00000000 Binary files a/docs/reference/gg_miss_var-11.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-12.png b/docs/reference/gg_miss_var-12.png deleted file mode 100644 index fabca968..00000000 Binary files a/docs/reference/gg_miss_var-12.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-13.png b/docs/reference/gg_miss_var-13.png deleted file mode 100644 index 2bc0aaed..00000000 Binary files a/docs/reference/gg_miss_var-13.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-14.png b/docs/reference/gg_miss_var-14.png deleted file mode 100644 index fabca968..00000000 Binary files a/docs/reference/gg_miss_var-14.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-15.png b/docs/reference/gg_miss_var-15.png deleted file mode 100644 index 2bc0aaed..00000000 Binary files a/docs/reference/gg_miss_var-15.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-16.png b/docs/reference/gg_miss_var-16.png deleted file mode 100644 index fabca968..00000000 Binary files a/docs/reference/gg_miss_var-16.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-17.png b/docs/reference/gg_miss_var-17.png deleted file mode 100644 index 2bc0aaed..00000000 Binary files a/docs/reference/gg_miss_var-17.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-18.png b/docs/reference/gg_miss_var-18.png deleted file mode 100644 index fabca968..00000000 Binary files a/docs/reference/gg_miss_var-18.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-2.png b/docs/reference/gg_miss_var-2.png deleted file mode 100644 index f6e3047d..00000000 Binary files a/docs/reference/gg_miss_var-2.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-3.png b/docs/reference/gg_miss_var-3.png deleted file mode 100644 index 63b1c3c7..00000000 Binary files a/docs/reference/gg_miss_var-3.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-4.png b/docs/reference/gg_miss_var-4.png deleted file mode 100644 index af0a1df1..00000000 Binary files a/docs/reference/gg_miss_var-4.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-5.png b/docs/reference/gg_miss_var-5.png deleted file mode 100644 index 93ec908f..00000000 Binary files a/docs/reference/gg_miss_var-5.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-6.png b/docs/reference/gg_miss_var-6.png deleted file mode 100644 index fabca968..00000000 Binary files a/docs/reference/gg_miss_var-6.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-7.png b/docs/reference/gg_miss_var-7.png deleted file mode 100644 index 2bc0aaed..00000000 Binary files a/docs/reference/gg_miss_var-7.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-8.png b/docs/reference/gg_miss_var-8.png deleted file mode 100644 index fabca968..00000000 Binary files a/docs/reference/gg_miss_var-8.png and /dev/null differ diff --git a/docs/reference/gg_miss_var-9.png b/docs/reference/gg_miss_var-9.png deleted file mode 100644 index 2bc0aaed..00000000 Binary files a/docs/reference/gg_miss_var-9.png and /dev/null differ diff --git a/docs/reference/gg_miss_var.html b/docs/reference/gg_miss_var.html deleted file mode 100644 index c50750ca..00000000 --- a/docs/reference/gg_miss_var.html +++ /dev/null @@ -1,139 +0,0 @@ - -Plot the number of missings for each variable — gg_miss_var • naniar - Skip to contents - - -
-
-
- -
-

This is a visual analogue to miss_var_summary. It draws a ggplot of the -number of missings in each variable, ordered to show which variables have -the most missing data. A default minimal theme is used, which can be -customised as normal for ggplot.

-
- -
-

Usage

-
gg_miss_var(x, facet, show_pct = FALSE)
-
- -
-

Arguments

-
x
-

a dataframe

- - -
facet
-

(optional) bare variable name, if you want to create a faceted plot.

- - -
show_pct
-

logical shows the number of missings (default), but if set to -TRUE, it will display the proportion of missings.

- -
-
-

Value

- - -

a ggplot object depicting the number of missings in a given column

-
- - -
-

Examples

-

-gg_miss_var(airquality)
-
-if (FALSE) {
-library(ggplot2)
-gg_miss_var(airquality) + labs(y = "Look at all the missing ones")
-gg_miss_var(airquality, Month)
-gg_miss_var(airquality, Month, show_pct = TRUE)
-gg_miss_var(airquality, Month, show_pct = TRUE) + ylim(0, 100)
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/gg_miss_var_cumsum-1.png b/docs/reference/gg_miss_var_cumsum-1.png deleted file mode 100644 index 610b80f2..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-1.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum-2.png b/docs/reference/gg_miss_var_cumsum-2.png deleted file mode 100644 index 53e757e3..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-2.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum-3.png b/docs/reference/gg_miss_var_cumsum-3.png deleted file mode 100644 index 9cd462cc..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-3.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum-4.png b/docs/reference/gg_miss_var_cumsum-4.png deleted file mode 100644 index 9cd462cc..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-4.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum-5.png b/docs/reference/gg_miss_var_cumsum-5.png deleted file mode 100644 index 9cd462cc..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-5.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum-6.png b/docs/reference/gg_miss_var_cumsum-6.png deleted file mode 100644 index 9cd462cc..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-6.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum-7.png b/docs/reference/gg_miss_var_cumsum-7.png deleted file mode 100644 index 9cd462cc..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-7.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum-8.png b/docs/reference/gg_miss_var_cumsum-8.png deleted file mode 100644 index 9cd462cc..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-8.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum-9.png b/docs/reference/gg_miss_var_cumsum-9.png deleted file mode 100644 index 9cd462cc..00000000 Binary files a/docs/reference/gg_miss_var_cumsum-9.png and /dev/null differ diff --git a/docs/reference/gg_miss_var_cumsum.html b/docs/reference/gg_miss_var_cumsum.html deleted file mode 100644 index dd695154..00000000 --- a/docs/reference/gg_miss_var_cumsum.html +++ /dev/null @@ -1,120 +0,0 @@ - -Plot of cumulative sum of missing value for each variable — gg_miss_var_cumsum • naniar - Skip to contents - - -
-
-
- -
-

A plot showing the cumulative sum of missing values for each variable, -reading columns from the left to the right of the initial dataframe. A -default minimal theme is used, which can be customised as normal for ggplot.

-
- -
-

Usage

-
gg_miss_var_cumsum(x)
-
- -
-

Arguments

-
x
-

a data.frame

- -
-
-

Value

- - -

a ggplot object showing the cumulative sum of missings over the variables

-
- - -
-

Examples

-

-gg_miss_var_cumsum(airquality)
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/gg_miss_which-1.png b/docs/reference/gg_miss_which-1.png deleted file mode 100644 index ab5b59fd..00000000 Binary files a/docs/reference/gg_miss_which-1.png and /dev/null differ diff --git a/docs/reference/gg_miss_which-2.png b/docs/reference/gg_miss_which-2.png deleted file mode 100644 index c0316dc2..00000000 Binary files a/docs/reference/gg_miss_which-2.png and /dev/null differ diff --git a/docs/reference/gg_miss_which-3.png b/docs/reference/gg_miss_which-3.png deleted file mode 100644 index 6dc8be1b..00000000 Binary files a/docs/reference/gg_miss_which-3.png and /dev/null differ diff --git a/docs/reference/gg_miss_which-4.png b/docs/reference/gg_miss_which-4.png deleted file mode 100644 index 6dc8be1b..00000000 Binary files a/docs/reference/gg_miss_which-4.png and /dev/null differ diff --git a/docs/reference/gg_miss_which-5.png b/docs/reference/gg_miss_which-5.png deleted file mode 100644 index 6dc8be1b..00000000 Binary files a/docs/reference/gg_miss_which-5.png and /dev/null differ diff --git a/docs/reference/gg_miss_which-6.png b/docs/reference/gg_miss_which-6.png deleted file mode 100644 index 6dc8be1b..00000000 Binary files a/docs/reference/gg_miss_which-6.png and /dev/null differ diff --git a/docs/reference/gg_miss_which-7.png b/docs/reference/gg_miss_which-7.png deleted file mode 100644 index 6dc8be1b..00000000 Binary files a/docs/reference/gg_miss_which-7.png and /dev/null differ diff --git a/docs/reference/gg_miss_which-8.png b/docs/reference/gg_miss_which-8.png deleted file mode 100644 index 6dc8be1b..00000000 Binary files a/docs/reference/gg_miss_which-8.png and /dev/null differ diff --git a/docs/reference/gg_miss_which-9.png b/docs/reference/gg_miss_which-9.png deleted file mode 100644 index 6dc8be1b..00000000 Binary files a/docs/reference/gg_miss_which-9.png and /dev/null differ diff --git a/docs/reference/gg_miss_which.html b/docs/reference/gg_miss_which.html deleted file mode 100644 index 9ae8c412..00000000 --- a/docs/reference/gg_miss_which.html +++ /dev/null @@ -1,120 +0,0 @@ - -Plot which variables contain a missing value — gg_miss_which • naniar - Skip to contents - - -
-
-
- -
-

This plot produces a set of rectangles indicating whether there is a missing -element in a column or not. A default minimal theme is used, which can be -customised as normal for ggplot.

-
- -
-

Usage

-
gg_miss_which(x)
-
- -
-

Arguments

-
x
-

a dataframe

- -
-
-

Value

- - -

a ggplot object of which variables contains missing values

-
- - -
-

Examples

-

-gg_miss_which(airquality)
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/gg_missing_case-2.png b/docs/reference/gg_missing_case-2.png deleted file mode 100644 index 187b9127..00000000 Binary files a/docs/reference/gg_missing_case-2.png and /dev/null differ diff --git a/docs/reference/gg_missing_case.html b/docs/reference/gg_missing_case.html deleted file mode 100644 index 70c9f337..00000000 --- a/docs/reference/gg_missing_case.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - -Plot the number of missings per case (row) — gg_missing_case • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

This function draws a ggplot of the number of missings in each row. -At this point I'm not sure how this plot should be arranged, as it currently looks a bit ugly!

- - -
gg_missing_case(x)
- -

Arguments

- - - - - - -
x

a dataframe

- -

Value

- -

a ggplot plot depicting the number of missings in a given case

- - -

Examples

-
-gg_missing_case(airquality)
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/gg_missing_var-2.png b/docs/reference/gg_missing_var-2.png deleted file mode 100644 index c598b111..00000000 Binary files a/docs/reference/gg_missing_var-2.png and /dev/null differ diff --git a/docs/reference/gg_missing_var.html b/docs/reference/gg_missing_var.html deleted file mode 100644 index 4b6ad1c9..00000000 --- a/docs/reference/gg_missing_var.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - -Plot the number of missings for each variable — gg_missing_var • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

This function draws a ggplot plot of the number of missings in each column, rearranged to show which variables have the most missing data.

- - -
gg_missing_var(x)
- -

Arguments

- - - - - - -
x

a dataframe

- -

Value

- -

a ggplot plot depicting the number of missings in a given column

- - -

Examples

-
-gg_missing_var(airquality)
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/gg_missing_which-2.png b/docs/reference/gg_missing_which-2.png deleted file mode 100644 index 195cc6a6..00000000 Binary files a/docs/reference/gg_missing_which-2.png and /dev/null differ diff --git a/docs/reference/gg_missing_which.html b/docs/reference/gg_missing_which.html deleted file mode 100644 index d1194d26..00000000 --- a/docs/reference/gg_missing_which.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - -Plot which variables contain a missing value — gg_missing_which • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

gg_missing_which (need a better name!) produces a set of rectangles that indicate whether there is a missing element in a column or not

- - -
gg_missing_which(x)
- -

Arguments

- - - - - - -
x

a dataframe

- -

Value

- -

a ggplot plot

- - -

Examples

-
-gg_missing_which(airquality)
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/group_by_fun.html b/docs/reference/group_by_fun.html deleted file mode 100644 index c96a4c7c..00000000 --- a/docs/reference/group_by_fun.html +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - -Group By Helper — group_by_fun • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

This is a wrapper to facilitate the grouped_df S3 method.

-
- -
group_by_fun(data, .fun, ...)
- -

Arguments

- - - - - - - - - - - - - - -
data

data.frame, which will be grouped

.fun

a function to apply

...

additional arguments to be passed to map

- -

Value

- -

a dataframe with the function applied to each group

- -

Examples

-
-if (FALSE) { -miss_case_table.grouped_df <- function(data){ -group_by_fun(data,.fun = miss_case_table) -} -airquality %>% -group_by(Month) %>% -miss_case_table() -}
-
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/impute_below.html b/docs/reference/impute_below.html deleted file mode 100644 index ec116b02..00000000 --- a/docs/reference/impute_below.html +++ /dev/null @@ -1,112 +0,0 @@ - -Impute data with values shifted 10 percent below range. — impute_below • naniar - Skip to contents - - -
-
-
- -
-

It can be useful in exploratory graphics to impute data outside the range of -the data. impute_below imputes all variables with missings to have values -10 percent below the range for numeric values, and for character or factor -values adds a new string or label. It is powered by shadow_shift, so please -see the documentation for shadow_shift() to full details on the different -implementations.

-
- -
-

Usage

-
impute_below(...)
-
- -
-

Arguments

-
...
-

extra arguments to pass - see shadow_shift() for discussion on this.

- -
- -
- - -
- - - - - - - diff --git a/docs/reference/impute_below_all.html b/docs/reference/impute_below_all.html deleted file mode 100644 index 8e3bf0e8..00000000 --- a/docs/reference/impute_below_all.html +++ /dev/null @@ -1,326 +0,0 @@ - -Impute data with values shifted 10 percent below range. — impute_below_all • naniar - Skip to contents - - -
-
-
- -
-

It can be useful in exploratory graphics to impute data outside the range of -the data. impute_below_all imputes all variables with missings to have -values 10\ -values adds a new string or label.

-
- -
-

Usage

-
impute_below_all(.tbl, prop_below = 0.1, jitter = 0.05, ...)
-
- -
-

Arguments

-
.tbl
-

a data.frame

- - -
prop_below
-

the degree to shift the values. default is

- - -
jitter
-

the amount of jitter to add. default is 0.05

- - -
...
-

additional arguments

- -
-
-

Value

- - -

an dataset with values imputed

-
- -
-

Examples

-

-# you can impute data like so:
-airquality %>%
-  impute_below_all()
-#>         Ozone   Solar.R Wind Temp Month Day
-#> 1    41.00000 190.00000  7.4   67     5   1
-#> 2    36.00000 118.00000  8.0   72     5   2
-#> 3    12.00000 149.00000 12.6   74     5   3
-#> 4    18.00000 313.00000 11.5   62     5   4
-#> 5   -19.72321 -33.57778 14.3   56     5   5
-#> 6    28.00000 -33.07810 14.9   66     5   6
-#> 7    23.00000 299.00000  8.6   65     5   7
-#> 8    19.00000  99.00000 13.8   59     5   8
-#> 9     8.00000  19.00000 20.1   61     5   9
-#> 10  -18.51277 194.00000  8.6   69     5  10
-#> 11    7.00000 -21.37719  6.9   74     5  11
-#> 12   16.00000 256.00000  9.7   69     5  12
-#> 13   11.00000 290.00000  9.2   66     5  13
-#> 14   14.00000 274.00000 10.9   68     5  14
-#> 15   18.00000  65.00000 13.2   58     5  15
-#> 16   14.00000 334.00000 11.5   64     5  16
-#> 17   34.00000 307.00000 12.0   66     5  17
-#> 18    6.00000  78.00000 18.4   57     5  18
-#> 19   30.00000 322.00000 11.5   68     5  19
-#> 20   11.00000  44.00000  9.7   62     5  20
-#> 21    1.00000   8.00000  9.7   59     5  21
-#> 22   11.00000 320.00000 16.6   73     5  22
-#> 23    4.00000  25.00000  9.7   61     5  23
-#> 24   32.00000  92.00000 12.0   61     5  24
-#> 25  -17.81863  66.00000 16.6   57     5  25
-#> 26  -19.43853 266.00000 14.9   58     5  26
-#> 27  -15.14310 -24.60954  8.0   57     5  27
-#> 28   23.00000  13.00000 12.0   67     5  28
-#> 29   45.00000 252.00000 14.9   81     5  29
-#> 30  115.00000 223.00000  5.7   79     5  30
-#> 31   37.00000 279.00000  7.4   76     5  31
-#> 32  -16.17315 286.00000  8.6   78     6   1
-#> 33  -14.65883 287.00000  9.7   74     6   2
-#> 34  -17.85609 242.00000 16.1   67     6   3
-#> 35  -13.29299 186.00000  9.2   84     6   4
-#> 36  -16.16323 220.00000  8.6   85     6   5
-#> 37  -19.60935 264.00000 14.3   79     6   6
-#> 38   29.00000 127.00000  9.7   82     6   7
-#> 39  -19.65780 273.00000  6.9   87     6   8
-#> 40   71.00000 291.00000 13.8   90     6   9
-#> 41   39.00000 323.00000 11.5   87     6  10
-#> 42  -13.40961 259.00000 10.9   93     6  11
-#> 43  -13.53728 250.00000  9.2   92     6  12
-#> 44   23.00000 148.00000  8.0   82     6  13
-#> 45  -19.65993 332.00000 13.8   80     6  14
-#> 46  -16.48342 322.00000 11.5   79     6  15
-#> 47   21.00000 191.00000 14.9   77     6  16
-#> 48   37.00000 284.00000 20.7   72     6  17
-#> 49   20.00000  37.00000  9.2   65     6  18
-#> 50   12.00000 120.00000 11.5   73     6  19
-#> 51   13.00000 137.00000 10.3   76     6  20
-#> 52  -17.17718 150.00000  6.3   77     6  21
-#> 53  -16.74073  59.00000  1.7   76     6  22
-#> 54  -13.65786  91.00000  4.6   76     6  23
-#> 55  -16.78786 250.00000  6.3   76     6  24
-#> 56  -12.30098 135.00000  8.0   75     6  25
-#> 57  -13.33171 127.00000  8.0   78     6  26
-#> 58  -16.77414  47.00000 10.3   73     6  27
-#> 59  -17.08225  98.00000 11.5   80     6  28
-#> 60  -15.98818  31.00000 14.9   77     6  29
-#> 61  -19.17558 138.00000  8.0   83     6  30
-#> 62  135.00000 269.00000  4.1   84     7   1
-#> 63   49.00000 248.00000  9.2   85     7   2
-#> 64   32.00000 236.00000  9.2   81     7   3
-#> 65  -14.27138 101.00000 10.9   84     7   4
-#> 66   64.00000 175.00000  4.6   83     7   5
-#> 67   40.00000 314.00000 10.9   83     7   6
-#> 68   77.00000 276.00000  5.1   88     7   7
-#> 69   97.00000 267.00000  6.3   92     7   8
-#> 70   97.00000 272.00000  5.7   92     7   9
-#> 71   85.00000 175.00000  7.4   89     7  10
-#> 72  -13.51764 139.00000  8.6   82     7  11
-#> 73   10.00000 264.00000 14.3   73     7  12
-#> 74   27.00000 175.00000 14.9   81     7  13
-#> 75  -13.48998 291.00000 14.9   91     7  14
-#> 76    7.00000  48.00000 14.3   80     7  15
-#> 77   48.00000 260.00000  6.9   81     7  16
-#> 78   35.00000 274.00000 10.3   82     7  17
-#> 79   61.00000 285.00000  6.3   84     7  18
-#> 80   79.00000 187.00000  5.1   87     7  19
-#> 81   63.00000 220.00000 11.5   85     7  20
-#> 82   16.00000   7.00000  6.9   74     7  21
-#> 83  -16.92150 258.00000  9.7   81     7  22
-#> 84  -16.60335 295.00000 11.5   82     7  23
-#> 85   80.00000 294.00000  8.6   86     7  24
-#> 86  108.00000 223.00000  8.0   85     7  25
-#> 87   20.00000  81.00000  8.6   82     7  26
-#> 88   52.00000  82.00000 12.0   86     7  27
-#> 89   82.00000 213.00000  7.4   88     7  28
-#> 90   50.00000 275.00000  7.4   86     7  29
-#> 91   64.00000 253.00000  7.4   83     7  30
-#> 92   59.00000 254.00000  9.2   81     7  31
-#> 93   39.00000  83.00000  6.9   81     8   1
-#> 94    9.00000  24.00000 13.8   81     8   2
-#> 95   16.00000  77.00000  7.4   82     8   3
-#> 96   78.00000 -30.94374  6.9   86     8   4
-#> 97   35.00000 -33.38707  7.4   85     8   5
-#> 98   66.00000 -21.48980  4.6   87     8   6
-#> 99  122.00000 255.00000  4.0   89     8   7
-#> 100  89.00000 229.00000 10.3   90     8   8
-#> 101 110.00000 207.00000  8.0   90     8   9
-#> 102 -14.78907 222.00000  8.6   92     8  10
-#> 103 -16.19151 137.00000 11.5   86     8  11
-#> 104  44.00000 192.00000 11.5   86     8  12
-#> 105  28.00000 273.00000 11.5   82     8  13
-#> 106  65.00000 157.00000  9.7   80     8  14
-#> 107 -19.73591  64.00000 11.5   79     8  15
-#> 108  22.00000  71.00000 10.3   77     8  16
-#> 109  59.00000  51.00000  6.3   79     8  17
-#> 110  23.00000 115.00000  7.4   76     8  18
-#> 111  31.00000 244.00000 10.9   78     8  19
-#> 112  44.00000 190.00000 10.3   78     8  20
-#> 113  21.00000 259.00000 15.5   77     8  21
-#> 114   9.00000  36.00000 14.3   72     8  22
-#> 115 -18.92235 255.00000 12.6   75     8  23
-#> 116  45.00000 212.00000  9.7   79     8  24
-#> 117 168.00000 238.00000  3.4   81     8  25
-#> 118  73.00000 215.00000  8.0   86     8  26
-#> 119 -14.86296 153.00000  5.7   88     8  27
-#> 120  76.00000 203.00000  9.7   97     8  28
-#> 121 118.00000 225.00000  2.3   94     8  29
-#> 122  84.00000 237.00000  6.3   96     8  30
-#> 123  85.00000 188.00000  6.3   94     8  31
-#> 124  96.00000 167.00000  6.9   91     9   1
-#> 125  78.00000 197.00000  5.1   92     9   2
-#> 126  73.00000 183.00000  2.8   93     9   3
-#> 127  91.00000 189.00000  4.6   93     9   4
-#> 128  47.00000  95.00000  7.4   87     9   5
-#> 129  32.00000  92.00000 15.5   84     9   6
-#> 130  20.00000 252.00000 10.9   80     9   7
-#> 131  23.00000 220.00000 10.3   78     9   8
-#> 132  21.00000 230.00000 10.9   75     9   9
-#> 133  24.00000 259.00000  9.7   73     9  10
-#> 134  44.00000 236.00000 14.9   81     9  11
-#> 135  21.00000 259.00000 15.5   76     9  12
-#> 136  28.00000 238.00000  6.3   77     9  13
-#> 137   9.00000  24.00000 10.9   71     9  14
-#> 138  13.00000 112.00000 11.5   71     9  15
-#> 139  46.00000 237.00000  6.9   78     9  16
-#> 140  18.00000 224.00000 13.8   67     9  17
-#> 141  13.00000  27.00000 10.3   76     9  18
-#> 142  24.00000 238.00000 10.3   68     9  19
-#> 143  16.00000 201.00000  8.0   82     9  20
-#> 144  13.00000 238.00000 12.6   64     9  21
-#> 145  23.00000  14.00000  9.2   71     9  22
-#> 146  36.00000 139.00000 10.3   81     9  23
-#> 147   7.00000  49.00000 10.3   69     9  24
-#> 148  14.00000  20.00000 16.6   63     9  25
-#> 149  30.00000 193.00000  6.9   70     9  26
-#> 150 -14.83089 145.00000 13.2   77     9  27
-#> 151  14.00000 191.00000 14.3   75     9  28
-#> 152  18.00000 131.00000  8.0   76     9  29
-#> 153  20.00000 223.00000 11.5   68     9  30
-
-# However, this does not show you WHERE the missing values are.
-# to keep track of them, you want to use `bind_shadow()` first.
-
-airquality %>%
-  bind_shadow() %>%
-  impute_below_all()
-#> # A tibble: 153 × 12
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA Wind_NA Temp_NA
-#>    <dbl>   <dbl> <dbl> <int> <int> <int> <fct>    <fct>      <fct>   <fct>  
-#>  1  41     190     7.4    67     5     1 !NA      !NA        !NA     !NA    
-#>  2  36     118     8      72     5     2 !NA      !NA        !NA     !NA    
-#>  3  12     149    12.6    74     5     3 !NA      !NA        !NA     !NA    
-#>  4  18     313    11.5    62     5     4 !NA      !NA        !NA     !NA    
-#>  5 -19.7   -33.6  14.3    56     5     5 NA       NA         !NA     !NA    
-#>  6  28     -33.1  14.9    66     5     6 !NA      NA         !NA     !NA    
-#>  7  23     299     8.6    65     5     7 !NA      !NA        !NA     !NA    
-#>  8  19      99    13.8    59     5     8 !NA      !NA        !NA     !NA    
-#>  9   8      19    20.1    61     5     9 !NA      !NA        !NA     !NA    
-#> 10 -18.5   194     8.6    69     5    10 NA       !NA        !NA     !NA    
-#> # ℹ 143 more rows
-#> # ℹ 2 more variables: Month_NA <fct>, Day_NA <fct>
-
-# This identifies where the missing values are located, which means you
-# can do things like this:
-
-if (FALSE) {
-library(ggplot2)
-airquality %>%
-  bind_shadow() %>%
-  impute_below_all() %>%
-  # identify where there are missings across rows.
-  add_label_shadow() %>%
-  ggplot(aes(x = Ozone,
-             y = Solar.R,
-             colour = any_missing)) +
-  geom_point()
-# Note that this ^^ is a long version of `geom_miss_point()`.
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/impute_below_at.html b/docs/reference/impute_below_at.html deleted file mode 100644 index 04f53dd4..00000000 --- a/docs/reference/impute_below_at.html +++ /dev/null @@ -1,462 +0,0 @@ - -Scoped variants of impute_below — impute_below_at • naniar - Skip to contents - - -
-
-
- -
-

impute_below operates on all variables. To only impute variables -that satisfy a specific condition, use the scoped variants, -impute_below_at, and impute_below_if. To use _at effectively, -you must know that _at`` affects variables selected with a character vector, or with vars()`.

-
- -
-

Usage

-
impute_below_at(.tbl, .vars, prop_below = 0.1, jitter = 0.05, ...)
-
- -
-

Arguments

-
.tbl
-

a data.frame

- - -
.vars
-

variables to impute

- - -
prop_below
-

the degree to shift the values. default is

- - -
jitter
-

the amount of jitter to add. default is 0.05

- - -
...
-

extra arguments

- -
-
-

Value

- - -

an dataset with values imputed

-
- -
-

Examples

-
# select variables starting with a particular string.
-impute_below_at(airquality,
-                .vars = c("Ozone", "Solar.R"))
-#>         Ozone   Solar.R Wind Temp Month Day
-#> 1    41.00000 190.00000  7.4   67     5   1
-#> 2    36.00000 118.00000  8.0   72     5   2
-#> 3    12.00000 149.00000 12.6   74     5   3
-#> 4    18.00000 313.00000 11.5   62     5   4
-#> 5   -19.72321 -33.57778 14.3   56     5   5
-#> 6    28.00000 -33.07810 14.9   66     5   6
-#> 7    23.00000 299.00000  8.6   65     5   7
-#> 8    19.00000  99.00000 13.8   59     5   8
-#> 9     8.00000  19.00000 20.1   61     5   9
-#> 10  -18.51277 194.00000  8.6   69     5  10
-#> 11    7.00000 -21.37719  6.9   74     5  11
-#> 12   16.00000 256.00000  9.7   69     5  12
-#> 13   11.00000 290.00000  9.2   66     5  13
-#> 14   14.00000 274.00000 10.9   68     5  14
-#> 15   18.00000  65.00000 13.2   58     5  15
-#> 16   14.00000 334.00000 11.5   64     5  16
-#> 17   34.00000 307.00000 12.0   66     5  17
-#> 18    6.00000  78.00000 18.4   57     5  18
-#> 19   30.00000 322.00000 11.5   68     5  19
-#> 20   11.00000  44.00000  9.7   62     5  20
-#> 21    1.00000   8.00000  9.7   59     5  21
-#> 22   11.00000 320.00000 16.6   73     5  22
-#> 23    4.00000  25.00000  9.7   61     5  23
-#> 24   32.00000  92.00000 12.0   61     5  24
-#> 25  -17.81863  66.00000 16.6   57     5  25
-#> 26  -19.43853 266.00000 14.9   58     5  26
-#> 27  -15.14310 -24.60954  8.0   57     5  27
-#> 28   23.00000  13.00000 12.0   67     5  28
-#> 29   45.00000 252.00000 14.9   81     5  29
-#> 30  115.00000 223.00000  5.7   79     5  30
-#> 31   37.00000 279.00000  7.4   76     5  31
-#> 32  -16.17315 286.00000  8.6   78     6   1
-#> 33  -14.65883 287.00000  9.7   74     6   2
-#> 34  -17.85609 242.00000 16.1   67     6   3
-#> 35  -13.29299 186.00000  9.2   84     6   4
-#> 36  -16.16323 220.00000  8.6   85     6   5
-#> 37  -19.60935 264.00000 14.3   79     6   6
-#> 38   29.00000 127.00000  9.7   82     6   7
-#> 39  -19.65780 273.00000  6.9   87     6   8
-#> 40   71.00000 291.00000 13.8   90     6   9
-#> 41   39.00000 323.00000 11.5   87     6  10
-#> 42  -13.40961 259.00000 10.9   93     6  11
-#> 43  -13.53728 250.00000  9.2   92     6  12
-#> 44   23.00000 148.00000  8.0   82     6  13
-#> 45  -19.65993 332.00000 13.8   80     6  14
-#> 46  -16.48342 322.00000 11.5   79     6  15
-#> 47   21.00000 191.00000 14.9   77     6  16
-#> 48   37.00000 284.00000 20.7   72     6  17
-#> 49   20.00000  37.00000  9.2   65     6  18
-#> 50   12.00000 120.00000 11.5   73     6  19
-#> 51   13.00000 137.00000 10.3   76     6  20
-#> 52  -17.17718 150.00000  6.3   77     6  21
-#> 53  -16.74073  59.00000  1.7   76     6  22
-#> 54  -13.65786  91.00000  4.6   76     6  23
-#> 55  -16.78786 250.00000  6.3   76     6  24
-#> 56  -12.30098 135.00000  8.0   75     6  25
-#> 57  -13.33171 127.00000  8.0   78     6  26
-#> 58  -16.77414  47.00000 10.3   73     6  27
-#> 59  -17.08225  98.00000 11.5   80     6  28
-#> 60  -15.98818  31.00000 14.9   77     6  29
-#> 61  -19.17558 138.00000  8.0   83     6  30
-#> 62  135.00000 269.00000  4.1   84     7   1
-#> 63   49.00000 248.00000  9.2   85     7   2
-#> 64   32.00000 236.00000  9.2   81     7   3
-#> 65  -14.27138 101.00000 10.9   84     7   4
-#> 66   64.00000 175.00000  4.6   83     7   5
-#> 67   40.00000 314.00000 10.9   83     7   6
-#> 68   77.00000 276.00000  5.1   88     7   7
-#> 69   97.00000 267.00000  6.3   92     7   8
-#> 70   97.00000 272.00000  5.7   92     7   9
-#> 71   85.00000 175.00000  7.4   89     7  10
-#> 72  -13.51764 139.00000  8.6   82     7  11
-#> 73   10.00000 264.00000 14.3   73     7  12
-#> 74   27.00000 175.00000 14.9   81     7  13
-#> 75  -13.48998 291.00000 14.9   91     7  14
-#> 76    7.00000  48.00000 14.3   80     7  15
-#> 77   48.00000 260.00000  6.9   81     7  16
-#> 78   35.00000 274.00000 10.3   82     7  17
-#> 79   61.00000 285.00000  6.3   84     7  18
-#> 80   79.00000 187.00000  5.1   87     7  19
-#> 81   63.00000 220.00000 11.5   85     7  20
-#> 82   16.00000   7.00000  6.9   74     7  21
-#> 83  -16.92150 258.00000  9.7   81     7  22
-#> 84  -16.60335 295.00000 11.5   82     7  23
-#> 85   80.00000 294.00000  8.6   86     7  24
-#> 86  108.00000 223.00000  8.0   85     7  25
-#> 87   20.00000  81.00000  8.6   82     7  26
-#> 88   52.00000  82.00000 12.0   86     7  27
-#> 89   82.00000 213.00000  7.4   88     7  28
-#> 90   50.00000 275.00000  7.4   86     7  29
-#> 91   64.00000 253.00000  7.4   83     7  30
-#> 92   59.00000 254.00000  9.2   81     7  31
-#> 93   39.00000  83.00000  6.9   81     8   1
-#> 94    9.00000  24.00000 13.8   81     8   2
-#> 95   16.00000  77.00000  7.4   82     8   3
-#> 96   78.00000 -30.94374  6.9   86     8   4
-#> 97   35.00000 -33.38707  7.4   85     8   5
-#> 98   66.00000 -21.48980  4.6   87     8   6
-#> 99  122.00000 255.00000  4.0   89     8   7
-#> 100  89.00000 229.00000 10.3   90     8   8
-#> 101 110.00000 207.00000  8.0   90     8   9
-#> 102 -14.78907 222.00000  8.6   92     8  10
-#> 103 -16.19151 137.00000 11.5   86     8  11
-#> 104  44.00000 192.00000 11.5   86     8  12
-#> 105  28.00000 273.00000 11.5   82     8  13
-#> 106  65.00000 157.00000  9.7   80     8  14
-#> 107 -19.73591  64.00000 11.5   79     8  15
-#> 108  22.00000  71.00000 10.3   77     8  16
-#> 109  59.00000  51.00000  6.3   79     8  17
-#> 110  23.00000 115.00000  7.4   76     8  18
-#> 111  31.00000 244.00000 10.9   78     8  19
-#> 112  44.00000 190.00000 10.3   78     8  20
-#> 113  21.00000 259.00000 15.5   77     8  21
-#> 114   9.00000  36.00000 14.3   72     8  22
-#> 115 -18.92235 255.00000 12.6   75     8  23
-#> 116  45.00000 212.00000  9.7   79     8  24
-#> 117 168.00000 238.00000  3.4   81     8  25
-#> 118  73.00000 215.00000  8.0   86     8  26
-#> 119 -14.86296 153.00000  5.7   88     8  27
-#> 120  76.00000 203.00000  9.7   97     8  28
-#> 121 118.00000 225.00000  2.3   94     8  29
-#> 122  84.00000 237.00000  6.3   96     8  30
-#> 123  85.00000 188.00000  6.3   94     8  31
-#> 124  96.00000 167.00000  6.9   91     9   1
-#> 125  78.00000 197.00000  5.1   92     9   2
-#> 126  73.00000 183.00000  2.8   93     9   3
-#> 127  91.00000 189.00000  4.6   93     9   4
-#> 128  47.00000  95.00000  7.4   87     9   5
-#> 129  32.00000  92.00000 15.5   84     9   6
-#> 130  20.00000 252.00000 10.9   80     9   7
-#> 131  23.00000 220.00000 10.3   78     9   8
-#> 132  21.00000 230.00000 10.9   75     9   9
-#> 133  24.00000 259.00000  9.7   73     9  10
-#> 134  44.00000 236.00000 14.9   81     9  11
-#> 135  21.00000 259.00000 15.5   76     9  12
-#> 136  28.00000 238.00000  6.3   77     9  13
-#> 137   9.00000  24.00000 10.9   71     9  14
-#> 138  13.00000 112.00000 11.5   71     9  15
-#> 139  46.00000 237.00000  6.9   78     9  16
-#> 140  18.00000 224.00000 13.8   67     9  17
-#> 141  13.00000  27.00000 10.3   76     9  18
-#> 142  24.00000 238.00000 10.3   68     9  19
-#> 143  16.00000 201.00000  8.0   82     9  20
-#> 144  13.00000 238.00000 12.6   64     9  21
-#> 145  23.00000  14.00000  9.2   71     9  22
-#> 146  36.00000 139.00000 10.3   81     9  23
-#> 147   7.00000  49.00000 10.3   69     9  24
-#> 148  14.00000  20.00000 16.6   63     9  25
-#> 149  30.00000 193.00000  6.9   70     9  26
-#> 150 -14.83089 145.00000 13.2   77     9  27
-#> 151  14.00000 191.00000 14.3   75     9  28
-#> 152  18.00000 131.00000  8.0   76     9  29
-#> 153  20.00000 223.00000 11.5   68     9  30
-
-impute_below_at(airquality, .vars = 1:2)
-#>         Ozone   Solar.R Wind Temp Month Day
-#> 1    41.00000 190.00000  7.4   67     5   1
-#> 2    36.00000 118.00000  8.0   72     5   2
-#> 3    12.00000 149.00000 12.6   74     5   3
-#> 4    18.00000 313.00000 11.5   62     5   4
-#> 5   -19.72321 -33.57778 14.3   56     5   5
-#> 6    28.00000 -33.07810 14.9   66     5   6
-#> 7    23.00000 299.00000  8.6   65     5   7
-#> 8    19.00000  99.00000 13.8   59     5   8
-#> 9     8.00000  19.00000 20.1   61     5   9
-#> 10  -18.51277 194.00000  8.6   69     5  10
-#> 11    7.00000 -21.37719  6.9   74     5  11
-#> 12   16.00000 256.00000  9.7   69     5  12
-#> 13   11.00000 290.00000  9.2   66     5  13
-#> 14   14.00000 274.00000 10.9   68     5  14
-#> 15   18.00000  65.00000 13.2   58     5  15
-#> 16   14.00000 334.00000 11.5   64     5  16
-#> 17   34.00000 307.00000 12.0   66     5  17
-#> 18    6.00000  78.00000 18.4   57     5  18
-#> 19   30.00000 322.00000 11.5   68     5  19
-#> 20   11.00000  44.00000  9.7   62     5  20
-#> 21    1.00000   8.00000  9.7   59     5  21
-#> 22   11.00000 320.00000 16.6   73     5  22
-#> 23    4.00000  25.00000  9.7   61     5  23
-#> 24   32.00000  92.00000 12.0   61     5  24
-#> 25  -17.81863  66.00000 16.6   57     5  25
-#> 26  -19.43853 266.00000 14.9   58     5  26
-#> 27  -15.14310 -24.60954  8.0   57     5  27
-#> 28   23.00000  13.00000 12.0   67     5  28
-#> 29   45.00000 252.00000 14.9   81     5  29
-#> 30  115.00000 223.00000  5.7   79     5  30
-#> 31   37.00000 279.00000  7.4   76     5  31
-#> 32  -16.17315 286.00000  8.6   78     6   1
-#> 33  -14.65883 287.00000  9.7   74     6   2
-#> 34  -17.85609 242.00000 16.1   67     6   3
-#> 35  -13.29299 186.00000  9.2   84     6   4
-#> 36  -16.16323 220.00000  8.6   85     6   5
-#> 37  -19.60935 264.00000 14.3   79     6   6
-#> 38   29.00000 127.00000  9.7   82     6   7
-#> 39  -19.65780 273.00000  6.9   87     6   8
-#> 40   71.00000 291.00000 13.8   90     6   9
-#> 41   39.00000 323.00000 11.5   87     6  10
-#> 42  -13.40961 259.00000 10.9   93     6  11
-#> 43  -13.53728 250.00000  9.2   92     6  12
-#> 44   23.00000 148.00000  8.0   82     6  13
-#> 45  -19.65993 332.00000 13.8   80     6  14
-#> 46  -16.48342 322.00000 11.5   79     6  15
-#> 47   21.00000 191.00000 14.9   77     6  16
-#> 48   37.00000 284.00000 20.7   72     6  17
-#> 49   20.00000  37.00000  9.2   65     6  18
-#> 50   12.00000 120.00000 11.5   73     6  19
-#> 51   13.00000 137.00000 10.3   76     6  20
-#> 52  -17.17718 150.00000  6.3   77     6  21
-#> 53  -16.74073  59.00000  1.7   76     6  22
-#> 54  -13.65786  91.00000  4.6   76     6  23
-#> 55  -16.78786 250.00000  6.3   76     6  24
-#> 56  -12.30098 135.00000  8.0   75     6  25
-#> 57  -13.33171 127.00000  8.0   78     6  26
-#> 58  -16.77414  47.00000 10.3   73     6  27
-#> 59  -17.08225  98.00000 11.5   80     6  28
-#> 60  -15.98818  31.00000 14.9   77     6  29
-#> 61  -19.17558 138.00000  8.0   83     6  30
-#> 62  135.00000 269.00000  4.1   84     7   1
-#> 63   49.00000 248.00000  9.2   85     7   2
-#> 64   32.00000 236.00000  9.2   81     7   3
-#> 65  -14.27138 101.00000 10.9   84     7   4
-#> 66   64.00000 175.00000  4.6   83     7   5
-#> 67   40.00000 314.00000 10.9   83     7   6
-#> 68   77.00000 276.00000  5.1   88     7   7
-#> 69   97.00000 267.00000  6.3   92     7   8
-#> 70   97.00000 272.00000  5.7   92     7   9
-#> 71   85.00000 175.00000  7.4   89     7  10
-#> 72  -13.51764 139.00000  8.6   82     7  11
-#> 73   10.00000 264.00000 14.3   73     7  12
-#> 74   27.00000 175.00000 14.9   81     7  13
-#> 75  -13.48998 291.00000 14.9   91     7  14
-#> 76    7.00000  48.00000 14.3   80     7  15
-#> 77   48.00000 260.00000  6.9   81     7  16
-#> 78   35.00000 274.00000 10.3   82     7  17
-#> 79   61.00000 285.00000  6.3   84     7  18
-#> 80   79.00000 187.00000  5.1   87     7  19
-#> 81   63.00000 220.00000 11.5   85     7  20
-#> 82   16.00000   7.00000  6.9   74     7  21
-#> 83  -16.92150 258.00000  9.7   81     7  22
-#> 84  -16.60335 295.00000 11.5   82     7  23
-#> 85   80.00000 294.00000  8.6   86     7  24
-#> 86  108.00000 223.00000  8.0   85     7  25
-#> 87   20.00000  81.00000  8.6   82     7  26
-#> 88   52.00000  82.00000 12.0   86     7  27
-#> 89   82.00000 213.00000  7.4   88     7  28
-#> 90   50.00000 275.00000  7.4   86     7  29
-#> 91   64.00000 253.00000  7.4   83     7  30
-#> 92   59.00000 254.00000  9.2   81     7  31
-#> 93   39.00000  83.00000  6.9   81     8   1
-#> 94    9.00000  24.00000 13.8   81     8   2
-#> 95   16.00000  77.00000  7.4   82     8   3
-#> 96   78.00000 -30.94374  6.9   86     8   4
-#> 97   35.00000 -33.38707  7.4   85     8   5
-#> 98   66.00000 -21.48980  4.6   87     8   6
-#> 99  122.00000 255.00000  4.0   89     8   7
-#> 100  89.00000 229.00000 10.3   90     8   8
-#> 101 110.00000 207.00000  8.0   90     8   9
-#> 102 -14.78907 222.00000  8.6   92     8  10
-#> 103 -16.19151 137.00000 11.5   86     8  11
-#> 104  44.00000 192.00000 11.5   86     8  12
-#> 105  28.00000 273.00000 11.5   82     8  13
-#> 106  65.00000 157.00000  9.7   80     8  14
-#> 107 -19.73591  64.00000 11.5   79     8  15
-#> 108  22.00000  71.00000 10.3   77     8  16
-#> 109  59.00000  51.00000  6.3   79     8  17
-#> 110  23.00000 115.00000  7.4   76     8  18
-#> 111  31.00000 244.00000 10.9   78     8  19
-#> 112  44.00000 190.00000 10.3   78     8  20
-#> 113  21.00000 259.00000 15.5   77     8  21
-#> 114   9.00000  36.00000 14.3   72     8  22
-#> 115 -18.92235 255.00000 12.6   75     8  23
-#> 116  45.00000 212.00000  9.7   79     8  24
-#> 117 168.00000 238.00000  3.4   81     8  25
-#> 118  73.00000 215.00000  8.0   86     8  26
-#> 119 -14.86296 153.00000  5.7   88     8  27
-#> 120  76.00000 203.00000  9.7   97     8  28
-#> 121 118.00000 225.00000  2.3   94     8  29
-#> 122  84.00000 237.00000  6.3   96     8  30
-#> 123  85.00000 188.00000  6.3   94     8  31
-#> 124  96.00000 167.00000  6.9   91     9   1
-#> 125  78.00000 197.00000  5.1   92     9   2
-#> 126  73.00000 183.00000  2.8   93     9   3
-#> 127  91.00000 189.00000  4.6   93     9   4
-#> 128  47.00000  95.00000  7.4   87     9   5
-#> 129  32.00000  92.00000 15.5   84     9   6
-#> 130  20.00000 252.00000 10.9   80     9   7
-#> 131  23.00000 220.00000 10.3   78     9   8
-#> 132  21.00000 230.00000 10.9   75     9   9
-#> 133  24.00000 259.00000  9.7   73     9  10
-#> 134  44.00000 236.00000 14.9   81     9  11
-#> 135  21.00000 259.00000 15.5   76     9  12
-#> 136  28.00000 238.00000  6.3   77     9  13
-#> 137   9.00000  24.00000 10.9   71     9  14
-#> 138  13.00000 112.00000 11.5   71     9  15
-#> 139  46.00000 237.00000  6.9   78     9  16
-#> 140  18.00000 224.00000 13.8   67     9  17
-#> 141  13.00000  27.00000 10.3   76     9  18
-#> 142  24.00000 238.00000 10.3   68     9  19
-#> 143  16.00000 201.00000  8.0   82     9  20
-#> 144  13.00000 238.00000 12.6   64     9  21
-#> 145  23.00000  14.00000  9.2   71     9  22
-#> 146  36.00000 139.00000 10.3   81     9  23
-#> 147   7.00000  49.00000 10.3   69     9  24
-#> 148  14.00000  20.00000 16.6   63     9  25
-#> 149  30.00000 193.00000  6.9   70     9  26
-#> 150 -14.83089 145.00000 13.2   77     9  27
-#> 151  14.00000 191.00000 14.3   75     9  28
-#> 152  18.00000 131.00000  8.0   76     9  29
-#> 153  20.00000 223.00000 11.5   68     9  30
-
-if (FALSE) {
-library(dplyr)
-impute_below_at(airquality,
-                .vars = vars(Ozone))
-
-library(ggplot2)
-airquality %>%
-  bind_shadow() %>%
-  impute_below_at(vars(Ozone, Solar.R)) %>%
-  add_label_shadow() %>%
-  ggplot(aes(x = Ozone,
-             y = Solar.R,
-             colour = any_missing)) +
-         geom_point()
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/impute_below_if.html b/docs/reference/impute_below_if.html deleted file mode 100644 index af3c06b5..00000000 --- a/docs/reference/impute_below_if.html +++ /dev/null @@ -1,287 +0,0 @@ - -Scoped variants of impute_below — impute_below_if • naniar - Skip to contents - - -
-
-
- -
-

impute_below operates on all variables. To only impute variables -that satisfy a specific condition, use the scoped variants, -impute_below_at, and impute_below_if.

-
- -
-

Usage

-
impute_below_if(.tbl, .predicate, prop_below = 0.1, jitter = 0.05, ...)
-
- -
-

Arguments

-
.tbl
-

data.frame

- - -
.predicate
-

A predicate function (such as is.numeric)

- - -
prop_below
-

the degree to shift the values. default is

- - -
jitter
-

the amount of jitter to add. default is 0.05

- - -
...
-

extra arguments

- -
-
-

Value

- - -

an dataset with values imputed

-
- -
-

Examples

-

-airquality %>%
-  impute_below_if(.predicate = is.numeric)
-#>         Ozone   Solar.R Wind Temp Month Day
-#> 1    41.00000 190.00000  7.4   67     5   1
-#> 2    36.00000 118.00000  8.0   72     5   2
-#> 3    12.00000 149.00000 12.6   74     5   3
-#> 4    18.00000 313.00000 11.5   62     5   4
-#> 5   -19.72321 -33.57778 14.3   56     5   5
-#> 6    28.00000 -33.07810 14.9   66     5   6
-#> 7    23.00000 299.00000  8.6   65     5   7
-#> 8    19.00000  99.00000 13.8   59     5   8
-#> 9     8.00000  19.00000 20.1   61     5   9
-#> 10  -18.51277 194.00000  8.6   69     5  10
-#> 11    7.00000 -21.37719  6.9   74     5  11
-#> 12   16.00000 256.00000  9.7   69     5  12
-#> 13   11.00000 290.00000  9.2   66     5  13
-#> 14   14.00000 274.00000 10.9   68     5  14
-#> 15   18.00000  65.00000 13.2   58     5  15
-#> 16   14.00000 334.00000 11.5   64     5  16
-#> 17   34.00000 307.00000 12.0   66     5  17
-#> 18    6.00000  78.00000 18.4   57     5  18
-#> 19   30.00000 322.00000 11.5   68     5  19
-#> 20   11.00000  44.00000  9.7   62     5  20
-#> 21    1.00000   8.00000  9.7   59     5  21
-#> 22   11.00000 320.00000 16.6   73     5  22
-#> 23    4.00000  25.00000  9.7   61     5  23
-#> 24   32.00000  92.00000 12.0   61     5  24
-#> 25  -17.81863  66.00000 16.6   57     5  25
-#> 26  -19.43853 266.00000 14.9   58     5  26
-#> 27  -15.14310 -24.60954  8.0   57     5  27
-#> 28   23.00000  13.00000 12.0   67     5  28
-#> 29   45.00000 252.00000 14.9   81     5  29
-#> 30  115.00000 223.00000  5.7   79     5  30
-#> 31   37.00000 279.00000  7.4   76     5  31
-#> 32  -16.17315 286.00000  8.6   78     6   1
-#> 33  -14.65883 287.00000  9.7   74     6   2
-#> 34  -17.85609 242.00000 16.1   67     6   3
-#> 35  -13.29299 186.00000  9.2   84     6   4
-#> 36  -16.16323 220.00000  8.6   85     6   5
-#> 37  -19.60935 264.00000 14.3   79     6   6
-#> 38   29.00000 127.00000  9.7   82     6   7
-#> 39  -19.65780 273.00000  6.9   87     6   8
-#> 40   71.00000 291.00000 13.8   90     6   9
-#> 41   39.00000 323.00000 11.5   87     6  10
-#> 42  -13.40961 259.00000 10.9   93     6  11
-#> 43  -13.53728 250.00000  9.2   92     6  12
-#> 44   23.00000 148.00000  8.0   82     6  13
-#> 45  -19.65993 332.00000 13.8   80     6  14
-#> 46  -16.48342 322.00000 11.5   79     6  15
-#> 47   21.00000 191.00000 14.9   77     6  16
-#> 48   37.00000 284.00000 20.7   72     6  17
-#> 49   20.00000  37.00000  9.2   65     6  18
-#> 50   12.00000 120.00000 11.5   73     6  19
-#> 51   13.00000 137.00000 10.3   76     6  20
-#> 52  -17.17718 150.00000  6.3   77     6  21
-#> 53  -16.74073  59.00000  1.7   76     6  22
-#> 54  -13.65786  91.00000  4.6   76     6  23
-#> 55  -16.78786 250.00000  6.3   76     6  24
-#> 56  -12.30098 135.00000  8.0   75     6  25
-#> 57  -13.33171 127.00000  8.0   78     6  26
-#> 58  -16.77414  47.00000 10.3   73     6  27
-#> 59  -17.08225  98.00000 11.5   80     6  28
-#> 60  -15.98818  31.00000 14.9   77     6  29
-#> 61  -19.17558 138.00000  8.0   83     6  30
-#> 62  135.00000 269.00000  4.1   84     7   1
-#> 63   49.00000 248.00000  9.2   85     7   2
-#> 64   32.00000 236.00000  9.2   81     7   3
-#> 65  -14.27138 101.00000 10.9   84     7   4
-#> 66   64.00000 175.00000  4.6   83     7   5
-#> 67   40.00000 314.00000 10.9   83     7   6
-#> 68   77.00000 276.00000  5.1   88     7   7
-#> 69   97.00000 267.00000  6.3   92     7   8
-#> 70   97.00000 272.00000  5.7   92     7   9
-#> 71   85.00000 175.00000  7.4   89     7  10
-#> 72  -13.51764 139.00000  8.6   82     7  11
-#> 73   10.00000 264.00000 14.3   73     7  12
-#> 74   27.00000 175.00000 14.9   81     7  13
-#> 75  -13.48998 291.00000 14.9   91     7  14
-#> 76    7.00000  48.00000 14.3   80     7  15
-#> 77   48.00000 260.00000  6.9   81     7  16
-#> 78   35.00000 274.00000 10.3   82     7  17
-#> 79   61.00000 285.00000  6.3   84     7  18
-#> 80   79.00000 187.00000  5.1   87     7  19
-#> 81   63.00000 220.00000 11.5   85     7  20
-#> 82   16.00000   7.00000  6.9   74     7  21
-#> 83  -16.92150 258.00000  9.7   81     7  22
-#> 84  -16.60335 295.00000 11.5   82     7  23
-#> 85   80.00000 294.00000  8.6   86     7  24
-#> 86  108.00000 223.00000  8.0   85     7  25
-#> 87   20.00000  81.00000  8.6   82     7  26
-#> 88   52.00000  82.00000 12.0   86     7  27
-#> 89   82.00000 213.00000  7.4   88     7  28
-#> 90   50.00000 275.00000  7.4   86     7  29
-#> 91   64.00000 253.00000  7.4   83     7  30
-#> 92   59.00000 254.00000  9.2   81     7  31
-#> 93   39.00000  83.00000  6.9   81     8   1
-#> 94    9.00000  24.00000 13.8   81     8   2
-#> 95   16.00000  77.00000  7.4   82     8   3
-#> 96   78.00000 -30.94374  6.9   86     8   4
-#> 97   35.00000 -33.38707  7.4   85     8   5
-#> 98   66.00000 -21.48980  4.6   87     8   6
-#> 99  122.00000 255.00000  4.0   89     8   7
-#> 100  89.00000 229.00000 10.3   90     8   8
-#> 101 110.00000 207.00000  8.0   90     8   9
-#> 102 -14.78907 222.00000  8.6   92     8  10
-#> 103 -16.19151 137.00000 11.5   86     8  11
-#> 104  44.00000 192.00000 11.5   86     8  12
-#> 105  28.00000 273.00000 11.5   82     8  13
-#> 106  65.00000 157.00000  9.7   80     8  14
-#> 107 -19.73591  64.00000 11.5   79     8  15
-#> 108  22.00000  71.00000 10.3   77     8  16
-#> 109  59.00000  51.00000  6.3   79     8  17
-#> 110  23.00000 115.00000  7.4   76     8  18
-#> 111  31.00000 244.00000 10.9   78     8  19
-#> 112  44.00000 190.00000 10.3   78     8  20
-#> 113  21.00000 259.00000 15.5   77     8  21
-#> 114   9.00000  36.00000 14.3   72     8  22
-#> 115 -18.92235 255.00000 12.6   75     8  23
-#> 116  45.00000 212.00000  9.7   79     8  24
-#> 117 168.00000 238.00000  3.4   81     8  25
-#> 118  73.00000 215.00000  8.0   86     8  26
-#> 119 -14.86296 153.00000  5.7   88     8  27
-#> 120  76.00000 203.00000  9.7   97     8  28
-#> 121 118.00000 225.00000  2.3   94     8  29
-#> 122  84.00000 237.00000  6.3   96     8  30
-#> 123  85.00000 188.00000  6.3   94     8  31
-#> 124  96.00000 167.00000  6.9   91     9   1
-#> 125  78.00000 197.00000  5.1   92     9   2
-#> 126  73.00000 183.00000  2.8   93     9   3
-#> 127  91.00000 189.00000  4.6   93     9   4
-#> 128  47.00000  95.00000  7.4   87     9   5
-#> 129  32.00000  92.00000 15.5   84     9   6
-#> 130  20.00000 252.00000 10.9   80     9   7
-#> 131  23.00000 220.00000 10.3   78     9   8
-#> 132  21.00000 230.00000 10.9   75     9   9
-#> 133  24.00000 259.00000  9.7   73     9  10
-#> 134  44.00000 236.00000 14.9   81     9  11
-#> 135  21.00000 259.00000 15.5   76     9  12
-#> 136  28.00000 238.00000  6.3   77     9  13
-#> 137   9.00000  24.00000 10.9   71     9  14
-#> 138  13.00000 112.00000 11.5   71     9  15
-#> 139  46.00000 237.00000  6.9   78     9  16
-#> 140  18.00000 224.00000 13.8   67     9  17
-#> 141  13.00000  27.00000 10.3   76     9  18
-#> 142  24.00000 238.00000 10.3   68     9  19
-#> 143  16.00000 201.00000  8.0   82     9  20
-#> 144  13.00000 238.00000 12.6   64     9  21
-#> 145  23.00000  14.00000  9.2   71     9  22
-#> 146  36.00000 139.00000 10.3   81     9  23
-#> 147   7.00000  49.00000 10.3   69     9  24
-#> 148  14.00000  20.00000 16.6   63     9  25
-#> 149  30.00000 193.00000  6.9   70     9  26
-#> 150 -14.83089 145.00000 13.2   77     9  27
-#> 151  14.00000 191.00000 14.3   75     9  28
-#> 152  18.00000 131.00000  8.0   76     9  29
-#> 153  20.00000 223.00000 11.5   68     9  30
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/impute_knn.html b/docs/reference/impute_knn.html deleted file mode 100644 index 10623c82..00000000 --- a/docs/reference/impute_knn.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -Impute nearest neighbours — impute_knn • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Impute nearest neighbours

- -
- -
impute_knn(.tbl, k = 5, method = "mean")
- -

Arguments

- - - - - - - - - - - - - - -
.tbl

data.frame with missing values

k

integer, default value 5

method
    -
  • "mean" or "random" - do you want to take the mean of the k -neighbours, do you want to take a random value from the k neighbours.

  • -
- -

Value

- -

data.frame with imputed values

- -

Note

- -

need to add separate functions for knn_avg and knn_rand, and also -scoped variants. Ideally, this should work on a vector first, with -different methods for each part

- - -

Examples

-
airquality %>% - bind_shadow() %>% - impute_knn("mean")
#> # A tibble: 153 x 12 -#> Ozone Solar.R Wind Temp Month Day Ozone_NA Solar.R_NA Wind_NA Temp_NA -#> <dbl> <dbl> <dbl> <int> <int> <int> <fct> <fct> <fct> <fct> -#> 1 41 190 7.4 67 5 1 !NA !NA !NA !NA -#> 2 36 118 8 72 5 2 !NA !NA !NA !NA -#> 3 12 149 12.6 74 5 3 !NA !NA !NA !NA -#> 4 18 313 11.5 62 5 4 !NA !NA !NA !NA -#> 5 42.1 185. 14.3 56 5 5 NA NA !NA !NA -#> 6 28 185. 14.9 66 5 6 !NA NA !NA !NA -#> 7 23 299 8.6 65 5 7 !NA !NA !NA !NA -#> 8 19 99 13.8 59 5 8 !NA !NA !NA !NA -#> 9 8 19 20.1 61 5 9 !NA !NA !NA !NA -#> 10 42.1 194 8.6 69 5 10 NA !NA !NA !NA -#> # ... with 143 more rows, and 2 more variables: Month_NA <fct>, Day_NA <fct>
-
# NOT RUN { -library(ggplot2) -airquality %>% - bind_shadow() %>% - impute_knn() %>% - add_label_shadow() %>% - ggplot(aes(x = Ozone, - y = Solar.R, - colour = any_missing)) + - geom_point() -# }
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/reference/impute_mean.html b/docs/reference/impute_mean.html deleted file mode 100644 index b62f1786..00000000 --- a/docs/reference/impute_mean.html +++ /dev/null @@ -1,122 +0,0 @@ - -Impute the mean value into a vector with missing values — impute_mean • naniar - Skip to contents - - -
-
-
- -
-

Impute the mean value into a vector with missing values

-
- -
-

Usage

-
impute_mean(x)
-
-# S3 method for default
-impute_mean(x)
-
-# S3 method for factor
-impute_mean(x)
-
- -
-

Arguments

-
x
-

vector

- -
-
-

Value

- - -

vector with mean values replaced

-
- -
-

Examples

-

-vec <- rnorm(10)
-
-vec[sample(1:10, 3)] <- NA
-
-impute_mean(vec)
-#>  [1] -0.008593142 -0.530161130 -0.561854135  0.509078646  0.115911160
-#>  [6]  0.036688637 -0.252584949  0.036688637  0.985024011  0.036688637
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/impute_median.html b/docs/reference/impute_median.html deleted file mode 100644 index bb47bad7..00000000 --- a/docs/reference/impute_median.html +++ /dev/null @@ -1,122 +0,0 @@ - -Impute the median value into a vector with missing values — impute_median • naniar - Skip to contents - - -
-
-
- -
-

Impute the median value into a vector with missing values

-
- -
-

Usage

-
impute_median(x)
-
-# S3 method for default
-impute_median(x)
-
-# S3 method for factor
-impute_median(x)
-
- -
-

Arguments

-
x
-

vector

- -
-
-

Value

- - -

vector with median values replaced

-
- -
-

Examples

-

-vec <- rnorm(10)
-
-vec[sample(1:10, 3)] <- NA
-
-impute_median(vec)
-#>  [1] -0.3795665 -0.5889187  1.4241911 -0.7945301 -0.8508759 -0.3795665
-#>  [7] -0.3795665  0.6699887  1.0867538 -0.3795665
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/impute_shift-1.png b/docs/reference/impute_shift-1.png deleted file mode 100644 index 1a6c29d6..00000000 Binary files a/docs/reference/impute_shift-1.png and /dev/null differ diff --git a/docs/reference/impute_shift.html b/docs/reference/impute_shift.html deleted file mode 100644 index aa445dbd..00000000 --- a/docs/reference/impute_shift.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - -Impute data with values shifted 10% below range. — impute_shift • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

It can be useful in exploratory graphics to impute data outside the range of -the data. impute_shift imputes values 10 -values, and for character or factor values adds a new string or label.

- -
- -
impute_shift(.tbl, ...)
- -

Arguments

- - - - - - - - - - -
.tbl

a data.frame

...

additional arguments

- -

Value

- -

an dataset with values imputed

- - -

Examples

-
-# you can impute data like so: -airquality %>% - impute_shift()
#> Ozone Solar.R Wind Temp Month Day -#> 1 41.00000 190.00000 7.4 67 5 1 -#> 2 36.00000 118.00000 8.0 72 5 2 -#> 3 12.00000 149.00000 12.6 74 5 3 -#> 4 18.00000 313.00000 11.5 62 5 4 -#> 5 -19.72321 -33.57778 14.3 56 5 5 -#> 6 28.00000 -33.07810 14.9 66 5 6 -#> 7 23.00000 299.00000 8.6 65 5 7 -#> 8 19.00000 99.00000 13.8 59 5 8 -#> 9 8.00000 19.00000 20.1 61 5 9 -#> 10 -18.51277 194.00000 8.6 69 5 10 -#> 11 7.00000 -21.37719 6.9 74 5 11 -#> 12 16.00000 256.00000 9.7 69 5 12 -#> 13 11.00000 290.00000 9.2 66 5 13 -#> 14 14.00000 274.00000 10.9 68 5 14 -#> 15 18.00000 65.00000 13.2 58 5 15 -#> 16 14.00000 334.00000 11.5 64 5 16 -#> 17 34.00000 307.00000 12.0 66 5 17 -#> 18 6.00000 78.00000 18.4 57 5 18 -#> 19 30.00000 322.00000 11.5 68 5 19 -#> 20 11.00000 44.00000 9.7 62 5 20 -#> 21 1.00000 8.00000 9.7 59 5 21 -#> 22 11.00000 320.00000 16.6 73 5 22 -#> 23 4.00000 25.00000 9.7 61 5 23 -#> 24 32.00000 92.00000 12.0 61 5 24 -#> 25 -17.81863 66.00000 16.6 57 5 25 -#> 26 -19.43853 266.00000 14.9 58 5 26 -#> 27 -15.14310 -24.60954 8.0 57 5 27 -#> 28 23.00000 13.00000 12.0 67 5 28 -#> 29 45.00000 252.00000 14.9 81 5 29 -#> 30 115.00000 223.00000 5.7 79 5 30 -#> 31 37.00000 279.00000 7.4 76 5 31 -#> 32 -16.17315 286.00000 8.6 78 6 1 -#> 33 -14.65883 287.00000 9.7 74 6 2 -#> 34 -17.85609 242.00000 16.1 67 6 3 -#> 35 -13.29299 186.00000 9.2 84 6 4 -#> 36 -16.16323 220.00000 8.6 85 6 5 -#> 37 -19.60935 264.00000 14.3 79 6 6 -#> 38 29.00000 127.00000 9.7 82 6 7 -#> 39 -19.65780 273.00000 6.9 87 6 8 -#> 40 71.00000 291.00000 13.8 90 6 9 -#> 41 39.00000 323.00000 11.5 87 6 10 -#> 42 -13.40961 259.00000 10.9 93 6 11 -#> 43 -13.53728 250.00000 9.2 92 6 12 -#> 44 23.00000 148.00000 8.0 82 6 13 -#> 45 -19.65993 332.00000 13.8 80 6 14 -#> 46 -16.48342 322.00000 11.5 79 6 15 -#> 47 21.00000 191.00000 14.9 77 6 16 -#> 48 37.00000 284.00000 20.7 72 6 17 -#> 49 20.00000 37.00000 9.2 65 6 18 -#> 50 12.00000 120.00000 11.5 73 6 19 -#> 51 13.00000 137.00000 10.3 76 6 20 -#> 52 -17.17718 150.00000 6.3 77 6 21 -#> 53 -16.74073 59.00000 1.7 76 6 22 -#> 54 -13.65786 91.00000 4.6 76 6 23 -#> 55 -16.78786 250.00000 6.3 76 6 24 -#> 56 -12.30098 135.00000 8.0 75 6 25 -#> 57 -13.33171 127.00000 8.0 78 6 26 -#> 58 -16.77414 47.00000 10.3 73 6 27 -#> 59 -17.08225 98.00000 11.5 80 6 28 -#> 60 -15.98818 31.00000 14.9 77 6 29 -#> 61 -19.17558 138.00000 8.0 83 6 30 -#> 62 135.00000 269.00000 4.1 84 7 1 -#> 63 49.00000 248.00000 9.2 85 7 2 -#> 64 32.00000 236.00000 9.2 81 7 3 -#> 65 -14.27138 101.00000 10.9 84 7 4 -#> 66 64.00000 175.00000 4.6 83 7 5 -#> 67 40.00000 314.00000 10.9 83 7 6 -#> 68 77.00000 276.00000 5.1 88 7 7 -#> 69 97.00000 267.00000 6.3 92 7 8 -#> 70 97.00000 272.00000 5.7 92 7 9 -#> 71 85.00000 175.00000 7.4 89 7 10 -#> 72 -13.51764 139.00000 8.6 82 7 11 -#> 73 10.00000 264.00000 14.3 73 7 12 -#> 74 27.00000 175.00000 14.9 81 7 13 -#> 75 -13.48998 291.00000 14.9 91 7 14 -#> 76 7.00000 48.00000 14.3 80 7 15 -#> 77 48.00000 260.00000 6.9 81 7 16 -#> 78 35.00000 274.00000 10.3 82 7 17 -#> 79 61.00000 285.00000 6.3 84 7 18 -#> 80 79.00000 187.00000 5.1 87 7 19 -#> 81 63.00000 220.00000 11.5 85 7 20 -#> 82 16.00000 7.00000 6.9 74 7 21 -#> 83 -16.92150 258.00000 9.7 81 7 22 -#> 84 -16.60335 295.00000 11.5 82 7 23 -#> 85 80.00000 294.00000 8.6 86 7 24 -#> 86 108.00000 223.00000 8.0 85 7 25 -#> 87 20.00000 81.00000 8.6 82 7 26 -#> 88 52.00000 82.00000 12.0 86 7 27 -#> 89 82.00000 213.00000 7.4 88 7 28 -#> 90 50.00000 275.00000 7.4 86 7 29 -#> 91 64.00000 253.00000 7.4 83 7 30 -#> 92 59.00000 254.00000 9.2 81 7 31 -#> 93 39.00000 83.00000 6.9 81 8 1 -#> 94 9.00000 24.00000 13.8 81 8 2 -#> 95 16.00000 77.00000 7.4 82 8 3 -#> 96 78.00000 -30.94374 6.9 86 8 4 -#> 97 35.00000 -33.38707 7.4 85 8 5 -#> 98 66.00000 -21.48980 4.6 87 8 6 -#> 99 122.00000 255.00000 4.0 89 8 7 -#> 100 89.00000 229.00000 10.3 90 8 8 -#> 101 110.00000 207.00000 8.0 90 8 9 -#> 102 -14.78907 222.00000 8.6 92 8 10 -#> 103 -16.19151 137.00000 11.5 86 8 11 -#> 104 44.00000 192.00000 11.5 86 8 12 -#> 105 28.00000 273.00000 11.5 82 8 13 -#> 106 65.00000 157.00000 9.7 80 8 14 -#> 107 -19.73591 64.00000 11.5 79 8 15 -#> 108 22.00000 71.00000 10.3 77 8 16 -#> 109 59.00000 51.00000 6.3 79 8 17 -#> 110 23.00000 115.00000 7.4 76 8 18 -#> 111 31.00000 244.00000 10.9 78 8 19 -#> 112 44.00000 190.00000 10.3 78 8 20 -#> 113 21.00000 259.00000 15.5 77 8 21 -#> 114 9.00000 36.00000 14.3 72 8 22 -#> 115 -18.92235 255.00000 12.6 75 8 23 -#> 116 45.00000 212.00000 9.7 79 8 24 -#> 117 168.00000 238.00000 3.4 81 8 25 -#> 118 73.00000 215.00000 8.0 86 8 26 -#> 119 -14.86296 153.00000 5.7 88 8 27 -#> 120 76.00000 203.00000 9.7 97 8 28 -#> 121 118.00000 225.00000 2.3 94 8 29 -#> 122 84.00000 237.00000 6.3 96 8 30 -#> 123 85.00000 188.00000 6.3 94 8 31 -#> 124 96.00000 167.00000 6.9 91 9 1 -#> 125 78.00000 197.00000 5.1 92 9 2 -#> 126 73.00000 183.00000 2.8 93 9 3 -#> 127 91.00000 189.00000 4.6 93 9 4 -#> 128 47.00000 95.00000 7.4 87 9 5 -#> 129 32.00000 92.00000 15.5 84 9 6 -#> 130 20.00000 252.00000 10.9 80 9 7 -#> 131 23.00000 220.00000 10.3 78 9 8 -#> 132 21.00000 230.00000 10.9 75 9 9 -#> 133 24.00000 259.00000 9.7 73 9 10 -#> 134 44.00000 236.00000 14.9 81 9 11 -#> 135 21.00000 259.00000 15.5 76 9 12 -#> 136 28.00000 238.00000 6.3 77 9 13 -#> 137 9.00000 24.00000 10.9 71 9 14 -#> 138 13.00000 112.00000 11.5 71 9 15 -#> 139 46.00000 237.00000 6.9 78 9 16 -#> 140 18.00000 224.00000 13.8 67 9 17 -#> 141 13.00000 27.00000 10.3 76 9 18 -#> 142 24.00000 238.00000 10.3 68 9 19 -#> 143 16.00000 201.00000 8.0 82 9 20 -#> 144 13.00000 238.00000 12.6 64 9 21 -#> 145 23.00000 14.00000 9.2 71 9 22 -#> 146 36.00000 139.00000 10.3 81 9 23 -#> 147 7.00000 49.00000 10.3 69 9 24 -#> 148 14.00000 20.00000 16.6 63 9 25 -#> 149 30.00000 193.00000 6.9 70 9 26 -#> 150 -14.83089 145.00000 13.2 77 9 27 -#> 151 14.00000 191.00000 14.3 75 9 28 -#> 152 18.00000 131.00000 8.0 76 9 29 -#> 153 20.00000 223.00000 11.5 68 9 30
-# However, this does not show you WHERE the missing values are. -# to keep track of them, you want to use `bind_shadow()` first. - -airquality %>% - bind_shadow() %>% - impute_shift()
#> # A tibble: 153 x 12 -#> Ozone Solar.R Wind Temp Month Day Ozone_NA Solar.R_NA Wind_NA Temp_NA -#> <dbl> <dbl> <dbl> <int> <int> <int> <fct> <fct> <fct> <fct> -#> 1 41.0 190. 7.40 67 5 1 !NA !NA !NA !NA -#> 2 36.0 118. 8.00 72 5 2 !NA !NA !NA !NA -#> 3 12.0 149. 12.6 74 5 3 !NA !NA !NA !NA -#> 4 18.0 313. 11.5 62 5 4 !NA !NA !NA !NA -#> 5 -19.7 -33.6 14.3 56 5 5 NA NA !NA !NA -#> 6 28.0 -33.1 14.9 66 5 6 !NA NA !NA !NA -#> 7 23.0 299. 8.60 65 5 7 !NA !NA !NA !NA -#> 8 19.0 99.0 13.8 59 5 8 !NA !NA !NA !NA -#> 9 8.00 19.0 20.1 61 5 9 !NA !NA !NA !NA -#> 10 -18.5 194. 8.60 69 5 10 NA !NA !NA !NA -#> # ... with 143 more rows, and 2 more variables: Month_NA <fct>, Day_NA <fct>
-# This identifies where the missing values are located, which means you -# can do things like this: - -library(ggplot2) -airquality %>% - bind_shadow() %>% - impute_shift() %>% - # identify where there are missings across rows. - add_label_shadow() %>% - ggplot(aes(x = Ozone, - y = Solar.R, - colour = any_missing)) + - geom_point()
-# This is a long version of `geom_miss_point()`. - -
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/reference/impute_shift_at.html b/docs/reference/impute_shift_at.html deleted file mode 100644 index 9edcb4e2..00000000 --- a/docs/reference/impute_shift_at.html +++ /dev/null @@ -1,648 +0,0 @@ - - - - - - - - -Scoped variants of <code>impute_shift</code> — impute_shift_at • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

impute_shift operates on all variables. To only impute variables -that satisfy a specific condition, use the scoped variants, -impute_shift_at, and impute_shift_if.

- -
- -
impute_shift_at(.tbl, .vars, ...)
- -

Arguments

- - - - - - - - - - - - - - -
.tbl

a data.frame

.vars

variables to impute

...

extra arguments

- -

Value

- -

an dataset with values imputed

- - -

Examples

-
# select variables starting with a particular string. -library(dplyr)
#> -#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’: -#> -#> filter, lag
#> The following object is masked from ‘package:testthat’: -#> -#> matches
#> The following objects are masked from ‘package:base’: -#> -#> intersect, setdiff, setequal, union
impute_shift_at(airquality, - .vars = starts_with("Oz"))
#> Ozone Solar.R Wind Temp Month Day -#> 1 41.00000 190 7.4 67 5 1 -#> 2 36.00000 118 8.0 72 5 2 -#> 3 12.00000 149 12.6 74 5 3 -#> 4 18.00000 313 11.5 62 5 4 -#> 5 -19.72321 NA 14.3 56 5 5 -#> 6 28.00000 NA 14.9 66 5 6 -#> 7 23.00000 299 8.6 65 5 7 -#> 8 19.00000 99 13.8 59 5 8 -#> 9 8.00000 19 20.1 61 5 9 -#> 10 -18.51277 194 8.6 69 5 10 -#> 11 7.00000 NA 6.9 74 5 11 -#> 12 16.00000 256 9.7 69 5 12 -#> 13 11.00000 290 9.2 66 5 13 -#> 14 14.00000 274 10.9 68 5 14 -#> 15 18.00000 65 13.2 58 5 15 -#> 16 14.00000 334 11.5 64 5 16 -#> 17 34.00000 307 12.0 66 5 17 -#> 18 6.00000 78 18.4 57 5 18 -#> 19 30.00000 322 11.5 68 5 19 -#> 20 11.00000 44 9.7 62 5 20 -#> 21 1.00000 8 9.7 59 5 21 -#> 22 11.00000 320 16.6 73 5 22 -#> 23 4.00000 25 9.7 61 5 23 -#> 24 32.00000 92 12.0 61 5 24 -#> 25 -17.81863 66 16.6 57 5 25 -#> 26 -19.43853 266 14.9 58 5 26 -#> 27 -15.14310 NA 8.0 57 5 27 -#> 28 23.00000 13 12.0 67 5 28 -#> 29 45.00000 252 14.9 81 5 29 -#> 30 115.00000 223 5.7 79 5 30 -#> 31 37.00000 279 7.4 76 5 31 -#> 32 -16.17315 286 8.6 78 6 1 -#> 33 -14.65883 287 9.7 74 6 2 -#> 34 -17.85609 242 16.1 67 6 3 -#> 35 -13.29299 186 9.2 84 6 4 -#> 36 -16.16323 220 8.6 85 6 5 -#> 37 -19.60935 264 14.3 79 6 6 -#> 38 29.00000 127 9.7 82 6 7 -#> 39 -19.65780 273 6.9 87 6 8 -#> 40 71.00000 291 13.8 90 6 9 -#> 41 39.00000 323 11.5 87 6 10 -#> 42 -13.40961 259 10.9 93 6 11 -#> 43 -13.53728 250 9.2 92 6 12 -#> 44 23.00000 148 8.0 82 6 13 -#> 45 -19.65993 332 13.8 80 6 14 -#> 46 -16.48342 322 11.5 79 6 15 -#> 47 21.00000 191 14.9 77 6 16 -#> 48 37.00000 284 20.7 72 6 17 -#> 49 20.00000 37 9.2 65 6 18 -#> 50 12.00000 120 11.5 73 6 19 -#> 51 13.00000 137 10.3 76 6 20 -#> 52 -17.17718 150 6.3 77 6 21 -#> 53 -16.74073 59 1.7 76 6 22 -#> 54 -13.65786 91 4.6 76 6 23 -#> 55 -16.78786 250 6.3 76 6 24 -#> 56 -12.30098 135 8.0 75 6 25 -#> 57 -13.33171 127 8.0 78 6 26 -#> 58 -16.77414 47 10.3 73 6 27 -#> 59 -17.08225 98 11.5 80 6 28 -#> 60 -15.98818 31 14.9 77 6 29 -#> 61 -19.17558 138 8.0 83 6 30 -#> 62 135.00000 269 4.1 84 7 1 -#> 63 49.00000 248 9.2 85 7 2 -#> 64 32.00000 236 9.2 81 7 3 -#> 65 -14.27138 101 10.9 84 7 4 -#> 66 64.00000 175 4.6 83 7 5 -#> 67 40.00000 314 10.9 83 7 6 -#> 68 77.00000 276 5.1 88 7 7 -#> 69 97.00000 267 6.3 92 7 8 -#> 70 97.00000 272 5.7 92 7 9 -#> 71 85.00000 175 7.4 89 7 10 -#> 72 -13.51764 139 8.6 82 7 11 -#> 73 10.00000 264 14.3 73 7 12 -#> 74 27.00000 175 14.9 81 7 13 -#> 75 -13.48998 291 14.9 91 7 14 -#> 76 7.00000 48 14.3 80 7 15 -#> 77 48.00000 260 6.9 81 7 16 -#> 78 35.00000 274 10.3 82 7 17 -#> 79 61.00000 285 6.3 84 7 18 -#> 80 79.00000 187 5.1 87 7 19 -#> 81 63.00000 220 11.5 85 7 20 -#> 82 16.00000 7 6.9 74 7 21 -#> 83 -16.92150 258 9.7 81 7 22 -#> 84 -16.60335 295 11.5 82 7 23 -#> 85 80.00000 294 8.6 86 7 24 -#> 86 108.00000 223 8.0 85 7 25 -#> 87 20.00000 81 8.6 82 7 26 -#> 88 52.00000 82 12.0 86 7 27 -#> 89 82.00000 213 7.4 88 7 28 -#> 90 50.00000 275 7.4 86 7 29 -#> 91 64.00000 253 7.4 83 7 30 -#> 92 59.00000 254 9.2 81 7 31 -#> 93 39.00000 83 6.9 81 8 1 -#> 94 9.00000 24 13.8 81 8 2 -#> 95 16.00000 77 7.4 82 8 3 -#> 96 78.00000 NA 6.9 86 8 4 -#> 97 35.00000 NA 7.4 85 8 5 -#> 98 66.00000 NA 4.6 87 8 6 -#> 99 122.00000 255 4.0 89 8 7 -#> 100 89.00000 229 10.3 90 8 8 -#> 101 110.00000 207 8.0 90 8 9 -#> 102 -14.78907 222 8.6 92 8 10 -#> 103 -16.19151 137 11.5 86 8 11 -#> 104 44.00000 192 11.5 86 8 12 -#> 105 28.00000 273 11.5 82 8 13 -#> 106 65.00000 157 9.7 80 8 14 -#> 107 -19.73591 64 11.5 79 8 15 -#> 108 22.00000 71 10.3 77 8 16 -#> 109 59.00000 51 6.3 79 8 17 -#> 110 23.00000 115 7.4 76 8 18 -#> 111 31.00000 244 10.9 78 8 19 -#> 112 44.00000 190 10.3 78 8 20 -#> 113 21.00000 259 15.5 77 8 21 -#> 114 9.00000 36 14.3 72 8 22 -#> 115 -18.92235 255 12.6 75 8 23 -#> 116 45.00000 212 9.7 79 8 24 -#> 117 168.00000 238 3.4 81 8 25 -#> 118 73.00000 215 8.0 86 8 26 -#> 119 -14.86296 153 5.7 88 8 27 -#> 120 76.00000 203 9.7 97 8 28 -#> 121 118.00000 225 2.3 94 8 29 -#> 122 84.00000 237 6.3 96 8 30 -#> 123 85.00000 188 6.3 94 8 31 -#> 124 96.00000 167 6.9 91 9 1 -#> 125 78.00000 197 5.1 92 9 2 -#> 126 73.00000 183 2.8 93 9 3 -#> 127 91.00000 189 4.6 93 9 4 -#> 128 47.00000 95 7.4 87 9 5 -#> 129 32.00000 92 15.5 84 9 6 -#> 130 20.00000 252 10.9 80 9 7 -#> 131 23.00000 220 10.3 78 9 8 -#> 132 21.00000 230 10.9 75 9 9 -#> 133 24.00000 259 9.7 73 9 10 -#> 134 44.00000 236 14.9 81 9 11 -#> 135 21.00000 259 15.5 76 9 12 -#> 136 28.00000 238 6.3 77 9 13 -#> 137 9.00000 24 10.9 71 9 14 -#> 138 13.00000 112 11.5 71 9 15 -#> 139 46.00000 237 6.9 78 9 16 -#> 140 18.00000 224 13.8 67 9 17 -#> 141 13.00000 27 10.3 76 9 18 -#> 142 24.00000 238 10.3 68 9 19 -#> 143 16.00000 201 8.0 82 9 20 -#> 144 13.00000 238 12.6 64 9 21 -#> 145 23.00000 14 9.2 71 9 22 -#> 146 36.00000 139 10.3 81 9 23 -#> 147 7.00000 49 10.3 69 9 24 -#> 148 14.00000 20 16.6 63 9 25 -#> 149 30.00000 193 6.9 70 9 26 -#> 150 -14.83089 145 13.2 77 9 27 -#> 151 14.00000 191 14.3 75 9 28 -#> 152 18.00000 131 8.0 76 9 29 -#> 153 20.00000 223 11.5 68 9 30
-impute_shift_at(airquality, - .vars = 1:2)
#> Ozone Solar.R Wind Temp Month Day -#> 1 41.00000 190.00000 7.4 67 5 1 -#> 2 36.00000 118.00000 8.0 72 5 2 -#> 3 12.00000 149.00000 12.6 74 5 3 -#> 4 18.00000 313.00000 11.5 62 5 4 -#> 5 -19.72321 -33.57778 14.3 56 5 5 -#> 6 28.00000 -33.07810 14.9 66 5 6 -#> 7 23.00000 299.00000 8.6 65 5 7 -#> 8 19.00000 99.00000 13.8 59 5 8 -#> 9 8.00000 19.00000 20.1 61 5 9 -#> 10 -18.51277 194.00000 8.6 69 5 10 -#> 11 7.00000 -21.37719 6.9 74 5 11 -#> 12 16.00000 256.00000 9.7 69 5 12 -#> 13 11.00000 290.00000 9.2 66 5 13 -#> 14 14.00000 274.00000 10.9 68 5 14 -#> 15 18.00000 65.00000 13.2 58 5 15 -#> 16 14.00000 334.00000 11.5 64 5 16 -#> 17 34.00000 307.00000 12.0 66 5 17 -#> 18 6.00000 78.00000 18.4 57 5 18 -#> 19 30.00000 322.00000 11.5 68 5 19 -#> 20 11.00000 44.00000 9.7 62 5 20 -#> 21 1.00000 8.00000 9.7 59 5 21 -#> 22 11.00000 320.00000 16.6 73 5 22 -#> 23 4.00000 25.00000 9.7 61 5 23 -#> 24 32.00000 92.00000 12.0 61 5 24 -#> 25 -17.81863 66.00000 16.6 57 5 25 -#> 26 -19.43853 266.00000 14.9 58 5 26 -#> 27 -15.14310 -24.60954 8.0 57 5 27 -#> 28 23.00000 13.00000 12.0 67 5 28 -#> 29 45.00000 252.00000 14.9 81 5 29 -#> 30 115.00000 223.00000 5.7 79 5 30 -#> 31 37.00000 279.00000 7.4 76 5 31 -#> 32 -16.17315 286.00000 8.6 78 6 1 -#> 33 -14.65883 287.00000 9.7 74 6 2 -#> 34 -17.85609 242.00000 16.1 67 6 3 -#> 35 -13.29299 186.00000 9.2 84 6 4 -#> 36 -16.16323 220.00000 8.6 85 6 5 -#> 37 -19.60935 264.00000 14.3 79 6 6 -#> 38 29.00000 127.00000 9.7 82 6 7 -#> 39 -19.65780 273.00000 6.9 87 6 8 -#> 40 71.00000 291.00000 13.8 90 6 9 -#> 41 39.00000 323.00000 11.5 87 6 10 -#> 42 -13.40961 259.00000 10.9 93 6 11 -#> 43 -13.53728 250.00000 9.2 92 6 12 -#> 44 23.00000 148.00000 8.0 82 6 13 -#> 45 -19.65993 332.00000 13.8 80 6 14 -#> 46 -16.48342 322.00000 11.5 79 6 15 -#> 47 21.00000 191.00000 14.9 77 6 16 -#> 48 37.00000 284.00000 20.7 72 6 17 -#> 49 20.00000 37.00000 9.2 65 6 18 -#> 50 12.00000 120.00000 11.5 73 6 19 -#> 51 13.00000 137.00000 10.3 76 6 20 -#> 52 -17.17718 150.00000 6.3 77 6 21 -#> 53 -16.74073 59.00000 1.7 76 6 22 -#> 54 -13.65786 91.00000 4.6 76 6 23 -#> 55 -16.78786 250.00000 6.3 76 6 24 -#> 56 -12.30098 135.00000 8.0 75 6 25 -#> 57 -13.33171 127.00000 8.0 78 6 26 -#> 58 -16.77414 47.00000 10.3 73 6 27 -#> 59 -17.08225 98.00000 11.5 80 6 28 -#> 60 -15.98818 31.00000 14.9 77 6 29 -#> 61 -19.17558 138.00000 8.0 83 6 30 -#> 62 135.00000 269.00000 4.1 84 7 1 -#> 63 49.00000 248.00000 9.2 85 7 2 -#> 64 32.00000 236.00000 9.2 81 7 3 -#> 65 -14.27138 101.00000 10.9 84 7 4 -#> 66 64.00000 175.00000 4.6 83 7 5 -#> 67 40.00000 314.00000 10.9 83 7 6 -#> 68 77.00000 276.00000 5.1 88 7 7 -#> 69 97.00000 267.00000 6.3 92 7 8 -#> 70 97.00000 272.00000 5.7 92 7 9 -#> 71 85.00000 175.00000 7.4 89 7 10 -#> 72 -13.51764 139.00000 8.6 82 7 11 -#> 73 10.00000 264.00000 14.3 73 7 12 -#> 74 27.00000 175.00000 14.9 81 7 13 -#> 75 -13.48998 291.00000 14.9 91 7 14 -#> 76 7.00000 48.00000 14.3 80 7 15 -#> 77 48.00000 260.00000 6.9 81 7 16 -#> 78 35.00000 274.00000 10.3 82 7 17 -#> 79 61.00000 285.00000 6.3 84 7 18 -#> 80 79.00000 187.00000 5.1 87 7 19 -#> 81 63.00000 220.00000 11.5 85 7 20 -#> 82 16.00000 7.00000 6.9 74 7 21 -#> 83 -16.92150 258.00000 9.7 81 7 22 -#> 84 -16.60335 295.00000 11.5 82 7 23 -#> 85 80.00000 294.00000 8.6 86 7 24 -#> 86 108.00000 223.00000 8.0 85 7 25 -#> 87 20.00000 81.00000 8.6 82 7 26 -#> 88 52.00000 82.00000 12.0 86 7 27 -#> 89 82.00000 213.00000 7.4 88 7 28 -#> 90 50.00000 275.00000 7.4 86 7 29 -#> 91 64.00000 253.00000 7.4 83 7 30 -#> 92 59.00000 254.00000 9.2 81 7 31 -#> 93 39.00000 83.00000 6.9 81 8 1 -#> 94 9.00000 24.00000 13.8 81 8 2 -#> 95 16.00000 77.00000 7.4 82 8 3 -#> 96 78.00000 -30.94374 6.9 86 8 4 -#> 97 35.00000 -33.38707 7.4 85 8 5 -#> 98 66.00000 -21.48980 4.6 87 8 6 -#> 99 122.00000 255.00000 4.0 89 8 7 -#> 100 89.00000 229.00000 10.3 90 8 8 -#> 101 110.00000 207.00000 8.0 90 8 9 -#> 102 -14.78907 222.00000 8.6 92 8 10 -#> 103 -16.19151 137.00000 11.5 86 8 11 -#> 104 44.00000 192.00000 11.5 86 8 12 -#> 105 28.00000 273.00000 11.5 82 8 13 -#> 106 65.00000 157.00000 9.7 80 8 14 -#> 107 -19.73591 64.00000 11.5 79 8 15 -#> 108 22.00000 71.00000 10.3 77 8 16 -#> 109 59.00000 51.00000 6.3 79 8 17 -#> 110 23.00000 115.00000 7.4 76 8 18 -#> 111 31.00000 244.00000 10.9 78 8 19 -#> 112 44.00000 190.00000 10.3 78 8 20 -#> 113 21.00000 259.00000 15.5 77 8 21 -#> 114 9.00000 36.00000 14.3 72 8 22 -#> 115 -18.92235 255.00000 12.6 75 8 23 -#> 116 45.00000 212.00000 9.7 79 8 24 -#> 117 168.00000 238.00000 3.4 81 8 25 -#> 118 73.00000 215.00000 8.0 86 8 26 -#> 119 -14.86296 153.00000 5.7 88 8 27 -#> 120 76.00000 203.00000 9.7 97 8 28 -#> 121 118.00000 225.00000 2.3 94 8 29 -#> 122 84.00000 237.00000 6.3 96 8 30 -#> 123 85.00000 188.00000 6.3 94 8 31 -#> 124 96.00000 167.00000 6.9 91 9 1 -#> 125 78.00000 197.00000 5.1 92 9 2 -#> 126 73.00000 183.00000 2.8 93 9 3 -#> 127 91.00000 189.00000 4.6 93 9 4 -#> 128 47.00000 95.00000 7.4 87 9 5 -#> 129 32.00000 92.00000 15.5 84 9 6 -#> 130 20.00000 252.00000 10.9 80 9 7 -#> 131 23.00000 220.00000 10.3 78 9 8 -#> 132 21.00000 230.00000 10.9 75 9 9 -#> 133 24.00000 259.00000 9.7 73 9 10 -#> 134 44.00000 236.00000 14.9 81 9 11 -#> 135 21.00000 259.00000 15.5 76 9 12 -#> 136 28.00000 238.00000 6.3 77 9 13 -#> 137 9.00000 24.00000 10.9 71 9 14 -#> 138 13.00000 112.00000 11.5 71 9 15 -#> 139 46.00000 237.00000 6.9 78 9 16 -#> 140 18.00000 224.00000 13.8 67 9 17 -#> 141 13.00000 27.00000 10.3 76 9 18 -#> 142 24.00000 238.00000 10.3 68 9 19 -#> 143 16.00000 201.00000 8.0 82 9 20 -#> 144 13.00000 238.00000 12.6 64 9 21 -#> 145 23.00000 14.00000 9.2 71 9 22 -#> 146 36.00000 139.00000 10.3 81 9 23 -#> 147 7.00000 49.00000 10.3 69 9 24 -#> 148 14.00000 20.00000 16.6 63 9 25 -#> 149 30.00000 193.00000 6.9 70 9 26 -#> 150 -14.83089 145.00000 13.2 77 9 27 -#> 151 14.00000 191.00000 14.3 75 9 28 -#> 152 18.00000 131.00000 8.0 76 9 29 -#> 153 20.00000 223.00000 11.5 68 9 30
-impute_shift_at(airquality, - .vars = everything())
#> Ozone Solar.R Wind Temp Month Day -#> 1 41.00000 190.00000 7.4 67 5 1 -#> 2 36.00000 118.00000 8.0 72 5 2 -#> 3 12.00000 149.00000 12.6 74 5 3 -#> 4 18.00000 313.00000 11.5 62 5 4 -#> 5 -19.72321 -33.57778 14.3 56 5 5 -#> 6 28.00000 -33.07810 14.9 66 5 6 -#> 7 23.00000 299.00000 8.6 65 5 7 -#> 8 19.00000 99.00000 13.8 59 5 8 -#> 9 8.00000 19.00000 20.1 61 5 9 -#> 10 -18.51277 194.00000 8.6 69 5 10 -#> 11 7.00000 -21.37719 6.9 74 5 11 -#> 12 16.00000 256.00000 9.7 69 5 12 -#> 13 11.00000 290.00000 9.2 66 5 13 -#> 14 14.00000 274.00000 10.9 68 5 14 -#> 15 18.00000 65.00000 13.2 58 5 15 -#> 16 14.00000 334.00000 11.5 64 5 16 -#> 17 34.00000 307.00000 12.0 66 5 17 -#> 18 6.00000 78.00000 18.4 57 5 18 -#> 19 30.00000 322.00000 11.5 68 5 19 -#> 20 11.00000 44.00000 9.7 62 5 20 -#> 21 1.00000 8.00000 9.7 59 5 21 -#> 22 11.00000 320.00000 16.6 73 5 22 -#> 23 4.00000 25.00000 9.7 61 5 23 -#> 24 32.00000 92.00000 12.0 61 5 24 -#> 25 -17.81863 66.00000 16.6 57 5 25 -#> 26 -19.43853 266.00000 14.9 58 5 26 -#> 27 -15.14310 -24.60954 8.0 57 5 27 -#> 28 23.00000 13.00000 12.0 67 5 28 -#> 29 45.00000 252.00000 14.9 81 5 29 -#> 30 115.00000 223.00000 5.7 79 5 30 -#> 31 37.00000 279.00000 7.4 76 5 31 -#> 32 -16.17315 286.00000 8.6 78 6 1 -#> 33 -14.65883 287.00000 9.7 74 6 2 -#> 34 -17.85609 242.00000 16.1 67 6 3 -#> 35 -13.29299 186.00000 9.2 84 6 4 -#> 36 -16.16323 220.00000 8.6 85 6 5 -#> 37 -19.60935 264.00000 14.3 79 6 6 -#> 38 29.00000 127.00000 9.7 82 6 7 -#> 39 -19.65780 273.00000 6.9 87 6 8 -#> 40 71.00000 291.00000 13.8 90 6 9 -#> 41 39.00000 323.00000 11.5 87 6 10 -#> 42 -13.40961 259.00000 10.9 93 6 11 -#> 43 -13.53728 250.00000 9.2 92 6 12 -#> 44 23.00000 148.00000 8.0 82 6 13 -#> 45 -19.65993 332.00000 13.8 80 6 14 -#> 46 -16.48342 322.00000 11.5 79 6 15 -#> 47 21.00000 191.00000 14.9 77 6 16 -#> 48 37.00000 284.00000 20.7 72 6 17 -#> 49 20.00000 37.00000 9.2 65 6 18 -#> 50 12.00000 120.00000 11.5 73 6 19 -#> 51 13.00000 137.00000 10.3 76 6 20 -#> 52 -17.17718 150.00000 6.3 77 6 21 -#> 53 -16.74073 59.00000 1.7 76 6 22 -#> 54 -13.65786 91.00000 4.6 76 6 23 -#> 55 -16.78786 250.00000 6.3 76 6 24 -#> 56 -12.30098 135.00000 8.0 75 6 25 -#> 57 -13.33171 127.00000 8.0 78 6 26 -#> 58 -16.77414 47.00000 10.3 73 6 27 -#> 59 -17.08225 98.00000 11.5 80 6 28 -#> 60 -15.98818 31.00000 14.9 77 6 29 -#> 61 -19.17558 138.00000 8.0 83 6 30 -#> 62 135.00000 269.00000 4.1 84 7 1 -#> 63 49.00000 248.00000 9.2 85 7 2 -#> 64 32.00000 236.00000 9.2 81 7 3 -#> 65 -14.27138 101.00000 10.9 84 7 4 -#> 66 64.00000 175.00000 4.6 83 7 5 -#> 67 40.00000 314.00000 10.9 83 7 6 -#> 68 77.00000 276.00000 5.1 88 7 7 -#> 69 97.00000 267.00000 6.3 92 7 8 -#> 70 97.00000 272.00000 5.7 92 7 9 -#> 71 85.00000 175.00000 7.4 89 7 10 -#> 72 -13.51764 139.00000 8.6 82 7 11 -#> 73 10.00000 264.00000 14.3 73 7 12 -#> 74 27.00000 175.00000 14.9 81 7 13 -#> 75 -13.48998 291.00000 14.9 91 7 14 -#> 76 7.00000 48.00000 14.3 80 7 15 -#> 77 48.00000 260.00000 6.9 81 7 16 -#> 78 35.00000 274.00000 10.3 82 7 17 -#> 79 61.00000 285.00000 6.3 84 7 18 -#> 80 79.00000 187.00000 5.1 87 7 19 -#> 81 63.00000 220.00000 11.5 85 7 20 -#> 82 16.00000 7.00000 6.9 74 7 21 -#> 83 -16.92150 258.00000 9.7 81 7 22 -#> 84 -16.60335 295.00000 11.5 82 7 23 -#> 85 80.00000 294.00000 8.6 86 7 24 -#> 86 108.00000 223.00000 8.0 85 7 25 -#> 87 20.00000 81.00000 8.6 82 7 26 -#> 88 52.00000 82.00000 12.0 86 7 27 -#> 89 82.00000 213.00000 7.4 88 7 28 -#> 90 50.00000 275.00000 7.4 86 7 29 -#> 91 64.00000 253.00000 7.4 83 7 30 -#> 92 59.00000 254.00000 9.2 81 7 31 -#> 93 39.00000 83.00000 6.9 81 8 1 -#> 94 9.00000 24.00000 13.8 81 8 2 -#> 95 16.00000 77.00000 7.4 82 8 3 -#> 96 78.00000 -30.94374 6.9 86 8 4 -#> 97 35.00000 -33.38707 7.4 85 8 5 -#> 98 66.00000 -21.48980 4.6 87 8 6 -#> 99 122.00000 255.00000 4.0 89 8 7 -#> 100 89.00000 229.00000 10.3 90 8 8 -#> 101 110.00000 207.00000 8.0 90 8 9 -#> 102 -14.78907 222.00000 8.6 92 8 10 -#> 103 -16.19151 137.00000 11.5 86 8 11 -#> 104 44.00000 192.00000 11.5 86 8 12 -#> 105 28.00000 273.00000 11.5 82 8 13 -#> 106 65.00000 157.00000 9.7 80 8 14 -#> 107 -19.73591 64.00000 11.5 79 8 15 -#> 108 22.00000 71.00000 10.3 77 8 16 -#> 109 59.00000 51.00000 6.3 79 8 17 -#> 110 23.00000 115.00000 7.4 76 8 18 -#> 111 31.00000 244.00000 10.9 78 8 19 -#> 112 44.00000 190.00000 10.3 78 8 20 -#> 113 21.00000 259.00000 15.5 77 8 21 -#> 114 9.00000 36.00000 14.3 72 8 22 -#> 115 -18.92235 255.00000 12.6 75 8 23 -#> 116 45.00000 212.00000 9.7 79 8 24 -#> 117 168.00000 238.00000 3.4 81 8 25 -#> 118 73.00000 215.00000 8.0 86 8 26 -#> 119 -14.86296 153.00000 5.7 88 8 27 -#> 120 76.00000 203.00000 9.7 97 8 28 -#> 121 118.00000 225.00000 2.3 94 8 29 -#> 122 84.00000 237.00000 6.3 96 8 30 -#> 123 85.00000 188.00000 6.3 94 8 31 -#> 124 96.00000 167.00000 6.9 91 9 1 -#> 125 78.00000 197.00000 5.1 92 9 2 -#> 126 73.00000 183.00000 2.8 93 9 3 -#> 127 91.00000 189.00000 4.6 93 9 4 -#> 128 47.00000 95.00000 7.4 87 9 5 -#> 129 32.00000 92.00000 15.5 84 9 6 -#> 130 20.00000 252.00000 10.9 80 9 7 -#> 131 23.00000 220.00000 10.3 78 9 8 -#> 132 21.00000 230.00000 10.9 75 9 9 -#> 133 24.00000 259.00000 9.7 73 9 10 -#> 134 44.00000 236.00000 14.9 81 9 11 -#> 135 21.00000 259.00000 15.5 76 9 12 -#> 136 28.00000 238.00000 6.3 77 9 13 -#> 137 9.00000 24.00000 10.9 71 9 14 -#> 138 13.00000 112.00000 11.5 71 9 15 -#> 139 46.00000 237.00000 6.9 78 9 16 -#> 140 18.00000 224.00000 13.8 67 9 17 -#> 141 13.00000 27.00000 10.3 76 9 18 -#> 142 24.00000 238.00000 10.3 68 9 19 -#> 143 16.00000 201.00000 8.0 82 9 20 -#> 144 13.00000 238.00000 12.6 64 9 21 -#> 145 23.00000 14.00000 9.2 71 9 22 -#> 146 36.00000 139.00000 10.3 81 9 23 -#> 147 7.00000 49.00000 10.3 69 9 24 -#> 148 14.00000 20.00000 16.6 63 9 25 -#> 149 30.00000 193.00000 6.9 70 9 26 -#> 150 -14.83089 145.00000 13.2 77 9 27 -#> 151 14.00000 191.00000 14.3 75 9 28 -#> 152 18.00000 131.00000 8.0 76 9 29 -#> 153 20.00000 223.00000 11.5 68 9 30
- -
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/reference/impute_shift_if.html b/docs/reference/impute_shift_if.html deleted file mode 100644 index 41c378d3..00000000 --- a/docs/reference/impute_shift_if.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - -Scoped variants of <code>impute_shift</code> — impute_shift_if • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

impute_shift operates on all variables. To only impute variables -that satisfy a specific condition, use the scoped variants, -impute_shift_at, and impute_shift_if.

- -
- -
impute_shift_if(.tbl, .predicate, ...)
- -

Arguments

- - - - - - - - - - - - - - -
.tbl

data.frame

.predicate

A predicate function (such as is.numeric)

...

extra arguments

- -

Value

- -

an dataset with values imputed

- - -

Examples

-
-airquality %>% - impute_shift_if(.predicate = is.numeric)
#> Ozone Solar.R Wind Temp Month Day -#> 1 41.00000 190.00000 7.4 67 5 1 -#> 2 36.00000 118.00000 8.0 72 5 2 -#> 3 12.00000 149.00000 12.6 74 5 3 -#> 4 18.00000 313.00000 11.5 62 5 4 -#> 5 -19.72321 -33.57778 14.3 56 5 5 -#> 6 28.00000 -33.07810 14.9 66 5 6 -#> 7 23.00000 299.00000 8.6 65 5 7 -#> 8 19.00000 99.00000 13.8 59 5 8 -#> 9 8.00000 19.00000 20.1 61 5 9 -#> 10 -18.51277 194.00000 8.6 69 5 10 -#> 11 7.00000 -21.37719 6.9 74 5 11 -#> 12 16.00000 256.00000 9.7 69 5 12 -#> 13 11.00000 290.00000 9.2 66 5 13 -#> 14 14.00000 274.00000 10.9 68 5 14 -#> 15 18.00000 65.00000 13.2 58 5 15 -#> 16 14.00000 334.00000 11.5 64 5 16 -#> 17 34.00000 307.00000 12.0 66 5 17 -#> 18 6.00000 78.00000 18.4 57 5 18 -#> 19 30.00000 322.00000 11.5 68 5 19 -#> 20 11.00000 44.00000 9.7 62 5 20 -#> 21 1.00000 8.00000 9.7 59 5 21 -#> 22 11.00000 320.00000 16.6 73 5 22 -#> 23 4.00000 25.00000 9.7 61 5 23 -#> 24 32.00000 92.00000 12.0 61 5 24 -#> 25 -17.81863 66.00000 16.6 57 5 25 -#> 26 -19.43853 266.00000 14.9 58 5 26 -#> 27 -15.14310 -24.60954 8.0 57 5 27 -#> 28 23.00000 13.00000 12.0 67 5 28 -#> 29 45.00000 252.00000 14.9 81 5 29 -#> 30 115.00000 223.00000 5.7 79 5 30 -#> 31 37.00000 279.00000 7.4 76 5 31 -#> 32 -16.17315 286.00000 8.6 78 6 1 -#> 33 -14.65883 287.00000 9.7 74 6 2 -#> 34 -17.85609 242.00000 16.1 67 6 3 -#> 35 -13.29299 186.00000 9.2 84 6 4 -#> 36 -16.16323 220.00000 8.6 85 6 5 -#> 37 -19.60935 264.00000 14.3 79 6 6 -#> 38 29.00000 127.00000 9.7 82 6 7 -#> 39 -19.65780 273.00000 6.9 87 6 8 -#> 40 71.00000 291.00000 13.8 90 6 9 -#> 41 39.00000 323.00000 11.5 87 6 10 -#> 42 -13.40961 259.00000 10.9 93 6 11 -#> 43 -13.53728 250.00000 9.2 92 6 12 -#> 44 23.00000 148.00000 8.0 82 6 13 -#> 45 -19.65993 332.00000 13.8 80 6 14 -#> 46 -16.48342 322.00000 11.5 79 6 15 -#> 47 21.00000 191.00000 14.9 77 6 16 -#> 48 37.00000 284.00000 20.7 72 6 17 -#> 49 20.00000 37.00000 9.2 65 6 18 -#> 50 12.00000 120.00000 11.5 73 6 19 -#> 51 13.00000 137.00000 10.3 76 6 20 -#> 52 -17.17718 150.00000 6.3 77 6 21 -#> 53 -16.74073 59.00000 1.7 76 6 22 -#> 54 -13.65786 91.00000 4.6 76 6 23 -#> 55 -16.78786 250.00000 6.3 76 6 24 -#> 56 -12.30098 135.00000 8.0 75 6 25 -#> 57 -13.33171 127.00000 8.0 78 6 26 -#> 58 -16.77414 47.00000 10.3 73 6 27 -#> 59 -17.08225 98.00000 11.5 80 6 28 -#> 60 -15.98818 31.00000 14.9 77 6 29 -#> 61 -19.17558 138.00000 8.0 83 6 30 -#> 62 135.00000 269.00000 4.1 84 7 1 -#> 63 49.00000 248.00000 9.2 85 7 2 -#> 64 32.00000 236.00000 9.2 81 7 3 -#> 65 -14.27138 101.00000 10.9 84 7 4 -#> 66 64.00000 175.00000 4.6 83 7 5 -#> 67 40.00000 314.00000 10.9 83 7 6 -#> 68 77.00000 276.00000 5.1 88 7 7 -#> 69 97.00000 267.00000 6.3 92 7 8 -#> 70 97.00000 272.00000 5.7 92 7 9 -#> 71 85.00000 175.00000 7.4 89 7 10 -#> 72 -13.51764 139.00000 8.6 82 7 11 -#> 73 10.00000 264.00000 14.3 73 7 12 -#> 74 27.00000 175.00000 14.9 81 7 13 -#> 75 -13.48998 291.00000 14.9 91 7 14 -#> 76 7.00000 48.00000 14.3 80 7 15 -#> 77 48.00000 260.00000 6.9 81 7 16 -#> 78 35.00000 274.00000 10.3 82 7 17 -#> 79 61.00000 285.00000 6.3 84 7 18 -#> 80 79.00000 187.00000 5.1 87 7 19 -#> 81 63.00000 220.00000 11.5 85 7 20 -#> 82 16.00000 7.00000 6.9 74 7 21 -#> 83 -16.92150 258.00000 9.7 81 7 22 -#> 84 -16.60335 295.00000 11.5 82 7 23 -#> 85 80.00000 294.00000 8.6 86 7 24 -#> 86 108.00000 223.00000 8.0 85 7 25 -#> 87 20.00000 81.00000 8.6 82 7 26 -#> 88 52.00000 82.00000 12.0 86 7 27 -#> 89 82.00000 213.00000 7.4 88 7 28 -#> 90 50.00000 275.00000 7.4 86 7 29 -#> 91 64.00000 253.00000 7.4 83 7 30 -#> 92 59.00000 254.00000 9.2 81 7 31 -#> 93 39.00000 83.00000 6.9 81 8 1 -#> 94 9.00000 24.00000 13.8 81 8 2 -#> 95 16.00000 77.00000 7.4 82 8 3 -#> 96 78.00000 -30.94374 6.9 86 8 4 -#> 97 35.00000 -33.38707 7.4 85 8 5 -#> 98 66.00000 -21.48980 4.6 87 8 6 -#> 99 122.00000 255.00000 4.0 89 8 7 -#> 100 89.00000 229.00000 10.3 90 8 8 -#> 101 110.00000 207.00000 8.0 90 8 9 -#> 102 -14.78907 222.00000 8.6 92 8 10 -#> 103 -16.19151 137.00000 11.5 86 8 11 -#> 104 44.00000 192.00000 11.5 86 8 12 -#> 105 28.00000 273.00000 11.5 82 8 13 -#> 106 65.00000 157.00000 9.7 80 8 14 -#> 107 -19.73591 64.00000 11.5 79 8 15 -#> 108 22.00000 71.00000 10.3 77 8 16 -#> 109 59.00000 51.00000 6.3 79 8 17 -#> 110 23.00000 115.00000 7.4 76 8 18 -#> 111 31.00000 244.00000 10.9 78 8 19 -#> 112 44.00000 190.00000 10.3 78 8 20 -#> 113 21.00000 259.00000 15.5 77 8 21 -#> 114 9.00000 36.00000 14.3 72 8 22 -#> 115 -18.92235 255.00000 12.6 75 8 23 -#> 116 45.00000 212.00000 9.7 79 8 24 -#> 117 168.00000 238.00000 3.4 81 8 25 -#> 118 73.00000 215.00000 8.0 86 8 26 -#> 119 -14.86296 153.00000 5.7 88 8 27 -#> 120 76.00000 203.00000 9.7 97 8 28 -#> 121 118.00000 225.00000 2.3 94 8 29 -#> 122 84.00000 237.00000 6.3 96 8 30 -#> 123 85.00000 188.00000 6.3 94 8 31 -#> 124 96.00000 167.00000 6.9 91 9 1 -#> 125 78.00000 197.00000 5.1 92 9 2 -#> 126 73.00000 183.00000 2.8 93 9 3 -#> 127 91.00000 189.00000 4.6 93 9 4 -#> 128 47.00000 95.00000 7.4 87 9 5 -#> 129 32.00000 92.00000 15.5 84 9 6 -#> 130 20.00000 252.00000 10.9 80 9 7 -#> 131 23.00000 220.00000 10.3 78 9 8 -#> 132 21.00000 230.00000 10.9 75 9 9 -#> 133 24.00000 259.00000 9.7 73 9 10 -#> 134 44.00000 236.00000 14.9 81 9 11 -#> 135 21.00000 259.00000 15.5 76 9 12 -#> 136 28.00000 238.00000 6.3 77 9 13 -#> 137 9.00000 24.00000 10.9 71 9 14 -#> 138 13.00000 112.00000 11.5 71 9 15 -#> 139 46.00000 237.00000 6.9 78 9 16 -#> 140 18.00000 224.00000 13.8 67 9 17 -#> 141 13.00000 27.00000 10.3 76 9 18 -#> 142 24.00000 238.00000 10.3 68 9 19 -#> 143 16.00000 201.00000 8.0 82 9 20 -#> 144 13.00000 238.00000 12.6 64 9 21 -#> 145 23.00000 14.00000 9.2 71 9 22 -#> 146 36.00000 139.00000 10.3 81 9 23 -#> 147 7.00000 49.00000 10.3 69 9 24 -#> 148 14.00000 20.00000 16.6 63 9 25 -#> 149 30.00000 193.00000 6.9 70 9 26 -#> 150 -14.83089 145.00000 13.2 77 9 27 -#> 151 14.00000 191.00000 14.3 75 9 28 -#> 152 18.00000 131.00000 8.0 76 9 29 -#> 153 20.00000 223.00000 11.5 68 9 30
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/reference/index.html b/docs/reference/index.html deleted file mode 100644 index 364953d6..00000000 --- a/docs/reference/index.html +++ /dev/null @@ -1,715 +0,0 @@ - -Function reference • naniar - Skip to contents - - -
-
-
- -
-

Data structures for missing data

- -

Creation and Manipulation of Shadow Matrices

- - -
- - - - -
- - as_shadow() -
-
Create shadows
-
- - as_shadow_upset() -
-
Convert data into shadow format for doing an upset plot
-
- - bind_shadow() -
-
Bind a shadow dataframe to original data
-
- - nabular() -
-
Convert data into nabular form by binding shade to it
-
- - gather_shadow() -
-
Long form representation of a shadow matrix
-
- - shade() -
-
Create new levels of missing
-
- - shadow_long() -
-
Reshape shadow data into a long format
-
- - unbind_shadow() unbind_data() -
-
Unbind (remove) shadow from data, and vice versa
-
- - shadow_shift() -
-
Shift missing values to facilitate missing data exploration/visualisation
-
- - shadow_shift(<numeric>) -
-
Shift (impute) numeric values for graphical exploration
-
-

Create special missing values

- -

Create special missing values so that they don’t get lost!

- - -
- - - - -
- - recode_shadow() -
-
Add special missing values to the shadow matrix
-
-

Visualisation

- -

Visualise missing data

- - -
- - - - -
- - geom_miss_point() -
-
geom_miss_point
-
- - stat_miss_point() -
-
stat_miss_point
-
- - gg_miss_case() -
-
Plot the number of missings per case (row)
-
- - gg_miss_case_cumsum() -
-
Plot of cumulative sum of missing for cases
-
- - gg_miss_fct() -
-
Plot the number of missings for each variable, broken down by a factor
-
- - gg_miss_span() -
-
Plot the number of missings in a given repeating span
-
- - gg_miss_upset() -
-
Plot the pattern of missingness using an upset plot.
-
- - gg_miss_var() -
-
Plot the number of missings for each variable
-
- - gg_miss_var_cumsum() -
-
Plot of cumulative sum of missing value for each variable
-
- - gg_miss_which() -
-
Plot which variables contain a missing value
-
- - reexports vis_miss %>% is_na are_na -
-
Objects exported from other packages
-
-

Numerical Summaries

- -

Provide tidy data frame summaries of missingness

- - -
- - - - -
- - miss_var_prop() complete_var_prop() miss_var_pct() complete_var_pct() miss_case_prop() complete_case_prop() miss_case_pct() complete_case_pct() -
-
Proportion of variables containing missings or complete values
-
- - miss_case_cumsum() -
-
Summarise the missingness in each case
-
- - miss_case_summary() -
-
Summarise the missingness in each case
-
- - miss_case_table() -
-
Tabulate missings in cases.
-
- - miss_prop_summary() -
-
Proportions of missings in data, variables, and cases.
-
- - miss_scan_count() -
-
Search and present different kinds of missing values
-
- - miss_summary() -
-
Collate summary measures from naniar into one tibble
-
- - miss_var_cumsum() -
-
Cumulative sum of the number of missings in each variable
-
- - miss_var_run() -
-
Find the number of missing and complete values in a single run
-
- - miss_var_span() -
-
Summarise the number of missings for a given repeating span on a variable
-
- - miss_var_summary() -
-
Summarise the missingness in each variable
-
- - miss_var_table() -
-
Tabulate the missings in the variables
-
- - miss_var_which() -
-
Which variables contain missing values?
-
-

Handy helpers

- -

Handy helpers

- - -
- - - - -
- - n_var_complete() n_case_complete() -
-
The number of variables with complete values
-
- - n_var_miss() n_case_miss() -
-
The number of variables or cases with missing values
-
- - n_complete() -
-
Return the number of complete values
-
- - n_complete_row() -
-
Return a vector of the number of complete values in each row
-
- - n_miss() -
-
Return the number of missing values
-
- - n_miss_row() -
-
Return a vector of the number of missing values in each row
-
- - prop_miss_case() prop_complete_case() -
-
Proportion of cases that contain a missing or complete values.
-
- - prop_miss_var() prop_complete_var() -
-
Proportion of variables containing missings or complete values
-
- - prop_complete() -
-
Return the proportion of complete values
-
- - prop_complete_row() -
-
Return a vector of the proportion of missing values in each row
-
- - prop_miss() -
-
Return the proportion of missing values
-
- - prop_miss_row() -
-
Return a vector of the proportion of missing values in each row
-
- - pct_miss_case() pct_complete_case() -
-
Percentage of cases that contain a missing or complete values.
-
- - pct_miss_var() pct_complete_var() -
-
Percentage of variables containing missings or complete values
-
- - pct_complete() -
-
Return the percent of complete values
-
- - pct_miss() -
-
Return the percent of missing values
-
- - all_na() all_miss() all_complete() -
-
Identify if all values are missing or complete
-
- - any_na() any_miss() any_complete() -
-
Identify if there are any missing or complete values
-
- - any_row_miss() -
-
Helper function to determine whether there are any missings
-
- - is_shade() are_shade() any_shade() -
-
Detect if this is a shade
-
- - which_are_shade() -
-
Which variables are shades?
-
- - common_na_numbers -
-
Common number values for NA
-
- - common_na_strings -
-
Common string values for NA
-
-

Add columns

- -

Add missing data summaries/tool columns

- - -
- - - - -
- - add_any_miss() -
-
Add a column describing presence of any missing values
-
- - add_label_missings() -
-
Add a column describing if there are any missings in the dataset
-
- - add_label_shadow() -
-
Add a column describing whether there is a shadow
-
- - add_miss_cluster() -
-
Add a column that tells us which "missingness cluster" a row belongs to
-
- - add_n_miss() -
-
Add column containing number of missing data values
-
- - add_prop_miss() -
-
Add column containing proportion of missing data values
-
- - add_shadow() -
-
Add a shadow column to dataframe
-
- - add_shadow_shift() -
-
Add a shadow shifted column to a dataset
-
- - add_span_counter() -
-
Add a counter variable for a span of dataframe
-
-

Replacing values with and to NA

- -

Functions to help replace certain values with NA, which includes scoped variants (_at, _if, _all) that take formulas for flexible approachs

- - -
- - - - -
- - replace_with_na() -
-
Replace values with missings
-
- - replace_with_na_all() -
-
Replace all values with NA where a certain condition is met
-
- - replace_with_na_at() -
-
Replace specified variables with NA where a certain condition is met
-
- - replace_with_na_if() -
-
Replace values with NA based on some condition, for variables that meet some predicate
-
- - replace_to_na() -
-
Replace values with missings
-
-

Imputation helpers

- -

Simple imputation methods for exploring visualisation and missingness structure

- - -
- - - - -
- - impute_below() -
-
Impute data with values shifted 10 percent below range.
-
- - impute_below_all() -
-
Impute data with values shifted 10 percent below range.
-
- - impute_below_at() -
-
Scoped variants of impute_below
-
- - impute_below_if() -
-
Scoped variants of impute_below
-
- - impute_mean() -
-
Impute the mean value into a vector with missing values
-
- - impute_median() -
-
Impute the median value into a vector with missing values
-
- - impute_mean_all() impute_mean_at() impute_mean_if() -
-
Scoped variants of impute_mean
-
- - impute_median_all() impute_median_at() impute_median_if() -
-
Scoped variants of impute_median
-
- - set_prop_miss() set_n_miss() -
-
Set a proportion or number of missing values
-
-

Package title details

- -

Details of the package naniar

- - -
- - - - -
- - naniar -
-
naniar
-
-

Cast Shadows

- -

Add shadow information to the dataframe while reducing it to the variables of interest

- - -
- - - - -
- - cast_shadow() -
-
Add a shadow column to a dataset
-
- - cast_shadow_shift() -
-
Add a shadow and a shadow_shift column to a dataset
-
- - cast_shadow_shift_label() -
-
Add a shadow column and a shadow shifted column to a dataset
-
-

Misc helpers

- -

Misc helpers

- - -
- - - - -
- - label_miss_1d() -
-
Label a missing from one column
-
- - label_miss_2d() -
-
label_miss_2d
-
- - label_missings() -
-
Is there a missing value in the row of a dataframe?
-
- - where_na() -
-
Which rows and cols contain missings?
-
- - which_na() -
-
Which elements contain missings?
-
- - .where() -
-
Split a call into two components with a useful verb name
-
-

Data Sources

- -

For practice and example usecases in naniar

- - -
- - - - -
- - oceanbuoys -
-
West Pacific Tropical Atmosphere Ocean Data, 1993 & 1997.
-
- - pedestrian -
-
Pedestrian count information around Melbourne for 2016
-
- - riskfactors -
-
The Behavioral Risk Factor Surveillance System (BRFSS) Survey -Data, 2009.
-
-

Little’s MCAR test

- -

For performing Little’s MCAR test

- - -
- - - - -
- - mcar_test() -
-
Little's missing completely at random (MCAR) test
-
-

ggplot2 extensions

- -

Custom ggplot geoms built to extend ggplot for missing values

- - -
- - - - -
- - StatMissPoint -
-
naniar-ggproto
-
-
- - -
- - - - - - - diff --git a/docs/reference/is_shade.html b/docs/reference/is_shade.html deleted file mode 100644 index f5b82d8f..00000000 --- a/docs/reference/is_shade.html +++ /dev/null @@ -1,134 +0,0 @@ - -Detect if this is a shade — is_shade • naniar - Skip to contents - - -
-
-
- -
-

This tells us if this column is a shade

-
- -
-

Usage

-
is_shade(x)
-
-are_shade(x)
-
-any_shade(x)
-
- -
-

Arguments

-
x
-

a vector you want to test if is a shade

- -
-
-

Value

- - -

logical - is this a shade?

-
- -
-

Examples

-

-xs <- shade(c(NA, 1, 2, "3"))
-
-is_shade(xs)
-#> [1] TRUE
-are_shade(xs)
-#> [1] TRUE TRUE TRUE TRUE
-any_shade(xs)
-#> [1] TRUE
-
-aq_s <- as_shadow(airquality)
-
-is_shade(aq_s)
-#> [1] FALSE
-are_shade(aq_s)
-#>   Ozone_NA Solar.R_NA    Wind_NA    Temp_NA   Month_NA     Day_NA 
-#>       TRUE       TRUE       TRUE       TRUE       TRUE       TRUE 
-any_shade(aq_s)
-#> [1] TRUE
-any_shade(airquality)
-#> [1] FALSE
-
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/is_shadow.html b/docs/reference/is_shadow.html deleted file mode 100644 index f0fcf934..00000000 --- a/docs/reference/is_shadow.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - - -Test if input is or are shadow variables — is_shadow • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Shadow matrix or "nabular" data is a useful way to store missing data to -facilitate missing data visualisation. This data can be created using -bind_shadow. is_shadow tells us if there are any shadow variables.

-
- -
is_shadow(x)
-
-is_nabular(x)
- -

Arguments

- - - - - - -
x

a vector or data.frame

- -

Value

- -

logical vector of length 1

- -

Examples

-
-aq_sh <- as_shadow(airquality) -aq_bind <- bind_shadow(airquality) - -is_shadow(aq_sh)
#> [1] TRUE
is_shadow(airquality)
#> [1] FALSE
is_shadow(aq_bind)
#> [1] FALSE
is_nabular(aq_bind)
#> [1] TRUE
-
-
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/label_miss_1d.html b/docs/reference/label_miss_1d.html deleted file mode 100644 index 49241ef7..00000000 --- a/docs/reference/label_miss_1d.html +++ /dev/null @@ -1,149 +0,0 @@ - -Label a missing from one column — label_miss_1d • naniar - Skip to contents - - -
-
-
- -
-

Label whether a value is missing in a row of one columns.

-
- -
-

Usage

-
label_miss_1d(x1)
-
- -
-

Arguments

-
x1
-

a variable of a dataframe

- -
-
-

Value

- - -

a vector indicating whether any of these rows had missing values

-
-
-

Note

-

can we generalise label_miss to work for any number of variables?

-
- - -
-

Examples

-

-label_miss_1d(airquality$Ozone)
-#>   [1] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>   [6] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [11] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [16] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [21] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [26] "Missing"     "Missing"     "Not Missing" "Not Missing" "Not Missing"
-#>  [31] "Not Missing" "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [36] "Missing"     "Missing"     "Not Missing" "Missing"     "Not Missing"
-#>  [41] "Not Missing" "Missing"     "Missing"     "Not Missing" "Missing"    
-#>  [46] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [51] "Not Missing" "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [56] "Missing"     "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [61] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [66] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [71] "Not Missing" "Missing"     "Not Missing" "Not Missing" "Missing"    
-#>  [76] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [81] "Not Missing" "Not Missing" "Missing"     "Missing"     "Not Missing"
-#>  [86] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [91] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [96] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [101] "Not Missing" "Missing"     "Missing"     "Not Missing" "Not Missing"
-#> [106] "Not Missing" "Missing"     "Not Missing" "Not Missing" "Not Missing"
-#> [111] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#> [116] "Not Missing" "Not Missing" "Not Missing" "Missing"     "Not Missing"
-#> [121] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [126] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [131] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [136] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [141] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [146] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#> [151] "Not Missing" "Not Missing" "Not Missing"
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/label_miss_2d.html b/docs/reference/label_miss_2d.html deleted file mode 100644 index a83e5989..00000000 --- a/docs/reference/label_miss_2d.html +++ /dev/null @@ -1,145 +0,0 @@ - -label_miss_2d — label_miss_2d • naniar - Skip to contents - - -
-
-
- -
-

Label whether a value is missing in either row of two columns.

-
- -
-

Usage

-
label_miss_2d(x1, x2)
-
- -
-

Arguments

-
x1
-

a variable of a dataframe

- - -
x2
-

another variable of a dataframe

- -
-
-

Value

- - -

a vector indicating whether any of these rows had missing values

-
- -
-

Examples

-

-label_miss_2d(airquality$Ozone, airquality$Solar.R)
-#>   [1] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>   [6] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [11] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [16] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [21] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [26] "Missing"     "Missing"     "Not Missing" "Not Missing" "Not Missing"
-#>  [31] "Not Missing" "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [36] "Missing"     "Missing"     "Not Missing" "Missing"     "Not Missing"
-#>  [41] "Not Missing" "Missing"     "Missing"     "Not Missing" "Missing"    
-#>  [46] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [51] "Not Missing" "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [56] "Missing"     "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [61] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [66] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [71] "Not Missing" "Missing"     "Not Missing" "Not Missing" "Missing"    
-#>  [76] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [81] "Not Missing" "Not Missing" "Missing"     "Missing"     "Not Missing"
-#>  [86] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [91] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [96] "Missing"     "Missing"     "Missing"     "Not Missing" "Not Missing"
-#> [101] "Not Missing" "Missing"     "Missing"     "Not Missing" "Not Missing"
-#> [106] "Not Missing" "Missing"     "Not Missing" "Not Missing" "Not Missing"
-#> [111] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#> [116] "Not Missing" "Not Missing" "Not Missing" "Missing"     "Not Missing"
-#> [121] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [126] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [131] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [136] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [141] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [146] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#> [151] "Not Missing" "Not Missing" "Not Missing"
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/label_missing_1d.html b/docs/reference/label_missing_1d.html deleted file mode 100644 index d0b66854..00000000 --- a/docs/reference/label_missing_1d.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -label_missing_1d — label_missing_1d • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Label whether a value is missing in either row of two columns. At the moment this is a more appealing alternative to miss_cat, which is at this stage a bit complicated.

- - -
label_missing_1d(x1)
- -

Arguments

- - - - - - -
x1

a variable of a dataframe

- -

Value

- -

a vector indicating whether any of these rows had missing values

- -

Note

- -

can we generalise label_missing to work for any number of variables?

- - -

Examples

-
-label_missing_1d(airquality$Ozone)
#> [1] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [6] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [11] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [16] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [21] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [26] "Missing" "Missing" "Not Missing" "Not Missing" "Not Missing" -#> [31] "Not Missing" "Missing" "Missing" "Missing" "Missing" -#> [36] "Missing" "Missing" "Not Missing" "Missing" "Not Missing" -#> [41] "Not Missing" "Missing" "Missing" "Not Missing" "Missing" -#> [46] "Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [51] "Not Missing" "Missing" "Missing" "Missing" "Missing" -#> [56] "Missing" "Missing" "Missing" "Missing" "Missing" -#> [61] "Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [66] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [71] "Not Missing" "Missing" "Not Missing" "Not Missing" "Missing" -#> [76] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [81] "Not Missing" "Not Missing" "Missing" "Missing" "Not Missing" -#> [86] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [91] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [96] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [101] "Not Missing" "Missing" "Missing" "Not Missing" "Not Missing" -#> [106] "Not Missing" "Missing" "Not Missing" "Not Missing" "Not Missing" -#> [111] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [116] "Not Missing" "Not Missing" "Not Missing" "Missing" "Not Missing" -#> [121] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [126] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [131] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [136] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [141] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [146] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [151] "Not Missing" "Not Missing" "Not Missing"
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/label_missing_2d.html b/docs/reference/label_missing_2d.html deleted file mode 100644 index 5fd2a9b9..00000000 --- a/docs/reference/label_missing_2d.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - -label_missing_2d — label_missing_2d • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Label whether a value is missing in either row of two columns. This is a more appealing alternative to miss_cat, which seems a bit overcomplicated.

- - -
label_missing_2d(x1, x2)
- -

Arguments

- - - - - - - - - - -
x1

a variable of a dataframe

x2

another variable of a dataframe

- -

Value

- -

a vector indicating whether any of these rows had missing values

- - -

Examples

-
-label_missing_2d(airquality$Ozone, airquality$Solar.R)
#> [1] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [6] "Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [11] "Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [16] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [21] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [26] "Missing" "Missing" "Not Missing" "Not Missing" "Not Missing" -#> [31] "Not Missing" "Missing" "Missing" "Missing" "Missing" -#> [36] "Missing" "Missing" "Not Missing" "Missing" "Not Missing" -#> [41] "Not Missing" "Missing" "Missing" "Not Missing" "Missing" -#> [46] "Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [51] "Not Missing" "Missing" "Missing" "Missing" "Missing" -#> [56] "Missing" "Missing" "Missing" "Missing" "Missing" -#> [61] "Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [66] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [71] "Not Missing" "Missing" "Not Missing" "Not Missing" "Missing" -#> [76] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [81] "Not Missing" "Not Missing" "Missing" "Missing" "Not Missing" -#> [86] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [91] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [96] "Missing" "Missing" "Missing" "Not Missing" "Not Missing" -#> [101] "Not Missing" "Missing" "Missing" "Not Missing" "Not Missing" -#> [106] "Not Missing" "Missing" "Not Missing" "Not Missing" "Not Missing" -#> [111] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [116] "Not Missing" "Not Missing" "Not Missing" "Missing" "Not Missing" -#> [121] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [126] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [131] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [136] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [141] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" -#> [146] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" -#> [151] "Not Missing" "Not Missing" "Not Missing"
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/label_missings.html b/docs/reference/label_missings.html deleted file mode 100644 index 985bf534..00000000 --- a/docs/reference/label_missings.html +++ /dev/null @@ -1,170 +0,0 @@ - -Is there a missing value in the row of a dataframe? — label_missings • naniar - Skip to contents - - -
-
-
- -
-

Creates a character vector describing presence/absence of missing values

-
- -
-

Usage

-
label_missings(data, ..., missing = "Missing", complete = "Not Missing")
-
- -
-

Arguments

-
data
-

a dataframe or set of vectors of the same length

- - -
...
-

extra variable to label

- - -
missing
-

character a label for when values are missing - defaults to "Missing"

- - -
complete
-

character character a label for when values are complete - defaults to "Not Missing"

- -
-
-

Value

- - -

character vector of "Missing" and "Not Missing".

-
- - -
-

Examples

-

-label_missings(airquality)
-#>   [1] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>   [6] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [11] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [16] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [21] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [26] "Missing"     "Missing"     "Not Missing" "Not Missing" "Not Missing"
-#>  [31] "Not Missing" "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [36] "Missing"     "Missing"     "Not Missing" "Missing"     "Not Missing"
-#>  [41] "Not Missing" "Missing"     "Missing"     "Not Missing" "Missing"    
-#>  [46] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [51] "Not Missing" "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [56] "Missing"     "Missing"     "Missing"     "Missing"     "Missing"    
-#>  [61] "Missing"     "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#>  [66] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [71] "Not Missing" "Missing"     "Not Missing" "Not Missing" "Missing"    
-#>  [76] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [81] "Not Missing" "Not Missing" "Missing"     "Missing"     "Not Missing"
-#>  [86] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [91] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#>  [96] "Missing"     "Missing"     "Missing"     "Not Missing" "Not Missing"
-#> [101] "Not Missing" "Missing"     "Missing"     "Not Missing" "Not Missing"
-#> [106] "Not Missing" "Missing"     "Not Missing" "Not Missing" "Not Missing"
-#> [111] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#> [116] "Not Missing" "Not Missing" "Not Missing" "Missing"     "Not Missing"
-#> [121] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [126] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [131] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [136] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [141] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing"
-#> [146] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing"    
-#> [151] "Not Missing" "Not Missing" "Not Missing"
-
-if (FALSE) {
-library(dplyr)
-
-airquality %>%
-  mutate(is_missing = label_missings(airquality)) %>%
-  head()
-
-airquality %>%
-  mutate(is_missing = label_missings(airquality,
-                                     missing = "definitely missing",
-                                     complete = "absolutely complete")) %>%
-  head()
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/label_na.html b/docs/reference/label_na.html deleted file mode 100644 index 78ab1000..00000000 --- a/docs/reference/label_na.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - -Give NAs a more meaningful label — label_na • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Returns a binary factor of !NA and NA, where !NA indicates a datum that is -not missing, and NA indicates missingness. This function is what powers the -factor levels in as_shadow().

- - -
label_na(x)
- -

Arguments

- - - - - - -
x

a vector

- -

Value

- -

a vector of factors containing the labels "!NA" for Not missing and -"NA" for missing.

- -

See also

- -

as_shadow

- - -

Examples

-
# NOT RUN {
-label_na(airquality$Ozone)
-# }
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/label_shadow.html b/docs/reference/label_shadow.html deleted file mode 100644 index 89beee32..00000000 --- a/docs/reference/label_shadow.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - -Label shadow values as missing or not missing — label_shadow • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Powers add_label_shadow. For the moment it is an internal function.

-
- -
label_shadow(data, ..., missing = "Missing", complete = "Not Missing")
- -

Arguments

- - - - - - - - - - - - - - - - - - -
data

data.frame

...

extra variable to label

missing

character a label for when values are missing - defaults to "Missing"

complete

character character a label for when values are complete - defaults to "Not Missing"

- -

Value

- -

"Missing" or "Not Missing"

- -
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/label_shadow_matrix.html b/docs/reference/label_shadow_matrix.html deleted file mode 100644 index 26407973..00000000 --- a/docs/reference/label_shadow_matrix.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -Give NAs a more meaningful label — label_shadow_matrix • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Returns a binary factor of !NA and NA, where !NA indicates a datum that is -not missing, and NA indicates missingness. This function is what powers the -factor levels in as_shadow().

- -
- -
label_shadow_matrix(x)
- -

Arguments

- - - - - - -
x

a vector

- -

Value

- -

a vector of factors containing the labels "!NA" for Not missing and -"NA" for missing.

- -

See also

- -

as_shadow

- - -

Examples

-
# NOT RUN {
-label_shadow_matrix(airquality$Ozone)
-# }
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - - - - diff --git a/docs/reference/miss-complete-case-pct.html b/docs/reference/miss-complete-case-pct.html deleted file mode 100644 index 859ad36b..00000000 --- a/docs/reference/miss-complete-case-pct.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - -Percentage of cases that contain a missing or complete values. — miss-complete-case-pct • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Deprecated, please see miss_case_pct() and complete_case_pct().

- -
- -
miss_case_pct(data)
-
-complete_case_pct(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the percentage of cases that contain a missing or complete -value

- -

See also

- - - - -
- -
- -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - - - - diff --git a/docs/reference/miss-complete-case-prop.html b/docs/reference/miss-complete-case-prop.html deleted file mode 100644 index 700b2573..00000000 --- a/docs/reference/miss-complete-case-prop.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - -Proportion of cases that contain a missing or complete values. — miss-complete-case-prop • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Deprecated, please see miss_case_prop() and complete_case_prop().

- -
- -
miss_case_prop(data)
-
-complete_case_prop(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the proportion of cases that contain a missing or complete -value

- -

See also

- - - - -
- -
- -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - - - - diff --git a/docs/reference/miss-complete-var-pct.html b/docs/reference/miss-complete-var-pct.html deleted file mode 100644 index 4e18c8ce..00000000 --- a/docs/reference/miss-complete-var-pct.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - -Percentage of variables containing missings or complete values — miss-complete-var-pct • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Deprecated. Please see miss_var_pct() and complete_var_pct().

- -
- -
miss_var_pct(data)
-
-complete_var_pct(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the percent of variables that contain missing or complete -data

- -

See also

- - - - -
- -
- -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - - - - diff --git a/docs/reference/miss-complete-var-prop.html b/docs/reference/miss-complete-var-prop.html deleted file mode 100644 index a69919fe..00000000 --- a/docs/reference/miss-complete-var-prop.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - -Proportion of variables containing missings or complete values — miss-complete-var-prop • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Deprecated. Please see miss_var_prop() and complete_var_prop().

- -
- -
miss_var_prop(data)
-
-complete_var_prop(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the proportion of variables that contain missing or complete -data

- -

See also

- - - - -
- -
- -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - - - - diff --git a/docs/reference/miss_case_cumsum.html b/docs/reference/miss_case_cumsum.html deleted file mode 100644 index 001c4e86..00000000 --- a/docs/reference/miss_case_cumsum.html +++ /dev/null @@ -1,135 +0,0 @@ - -Summarise the missingness in each case — miss_case_cumsum • naniar - Skip to contents - - -
-
-
- -
-

Provide a data.frame containing each case (row), the number and percent of -missing values in each case.

-
- -
-

Usage

-
miss_case_cumsum(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

a tibble containing the number and percent of missing data in each -case

-
- -
-

Examples

-

-miss_case_cumsum(airquality)
-#> # A tibble: 153 × 3
-#>     case n_miss n_miss_cumsum
-#>    <int>  <int>         <int>
-#>  1     1      0             0
-#>  2     2      0             0
-#>  3     3      0             0
-#>  4     4      0             0
-#>  5     5      2             2
-#>  6     6      1             3
-#>  7     7      0             3
-#>  8     8      0             3
-#>  9     9      0             3
-#> 10    10      1             4
-#> # ℹ 143 more rows
-
-if (FALSE) {
-library(dplyr)
-
-airquality %>%
-  group_by(Month) %>%
-  miss_case_cumsum()
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_case_pct.html b/docs/reference/miss_case_pct.html deleted file mode 100644 index c7a29013..00000000 --- a/docs/reference/miss_case_pct.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - -Percentage of cases that contain a missing values. — miss_case_pct • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Calculate the percentage of cases (rows) that contain a missing value.

- -
- -
miss_case_pct(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the percentage of cases that contain a missing value

- -

See also

- - - - -

Examples

-
-miss_case_pct(airquality)
#> [1] 27.45098
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/reference/miss_case_prop.html b/docs/reference/miss_case_prop.html deleted file mode 100644 index 22db58b9..00000000 --- a/docs/reference/miss_case_prop.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - -Proportion of cases that contain a missing values. — miss_case_prop • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Calculate the proportion of cases (rows) that contain a missing value.

- -
- -
miss_case_prop(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the proportion of cases that contain a missing value

- -

See also

- - - - -

Examples

-
-miss_case_prop(airquality)
#> [1] 0.2745098
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/reference/miss_case_summary.html b/docs/reference/miss_case_summary.html deleted file mode 100644 index 917b91e5..00000000 --- a/docs/reference/miss_case_summary.html +++ /dev/null @@ -1,158 +0,0 @@ - -Summarise the missingness in each case — miss_case_summary • naniar - Skip to contents - - -
-
-
- -
-

Provide a summary for each case in the data of the number, percent missings, -and cumulative sum of missings of the order of the variables. By default, -it orders by the most missings in each variable.

-
- -
-

Usage

-
miss_case_summary(data, order = TRUE, add_cumsum = FALSE, ...)
-
- -
-

Arguments

-
data
-

a data.frame

- - -
order
-

a logical indicating whether or not to order the result by -n_miss. Defaults to TRUE. If FALSE, order of cases is the order input.

- - -
add_cumsum
-

logical indicating whether or not to add the cumulative -sum of missings to the data. This can be useful when exploring patterns -of nonresponse. These are calculated as the cumulative sum of the missings -in the variables as they are first presented to the function.

- - -
...
-

extra arguments

- -
-
-

Value

- - -

a tibble of the percent of missing data in each case.

-
- - -
-

Examples

-

-miss_case_summary(airquality)
-#> # A tibble: 153 × 3
-#>     case n_miss pct_miss
-#>    <int>  <int>    <dbl>
-#>  1     5      2     33.3
-#>  2    27      2     33.3
-#>  3     6      1     16.7
-#>  4    10      1     16.7
-#>  5    11      1     16.7
-#>  6    25      1     16.7
-#>  7    26      1     16.7
-#>  8    32      1     16.7
-#>  9    33      1     16.7
-#> 10    34      1     16.7
-#> # ℹ 143 more rows
-
-if (FALSE) {
-# works with group_by from dplyr
-library(dplyr)
-airquality %>%
-  group_by(Month) %>%
-  miss_case_summary()
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_case_table.html b/docs/reference/miss_case_table.html deleted file mode 100644 index ab88cf30..00000000 --- a/docs/reference/miss_case_table.html +++ /dev/null @@ -1,128 +0,0 @@ - -Tabulate missings in cases. — miss_case_table • naniar - Skip to contents - - -
-
-
- -
-

Provide a tidy table of the number of cases with 0, 1, 2, up to n, missing -values and the proportion of the number of cases those cases make up.

-
- -
-

Usage

-
miss_case_table(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

a dataframe

-
- - -
-

Examples

-

-miss_case_table(airquality)
-#> # A tibble: 3 × 3
-#>   n_miss_in_case n_cases pct_cases
-#>            <int>   <int>     <dbl>
-#> 1              0     111     72.5 
-#> 2              1      40     26.1 
-#> 3              2       2      1.31
-if (FALSE) {
-library(dplyr)
-airquality %>%
-  group_by(Month) %>%
-  miss_case_table()
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_df_pct.html b/docs/reference/miss_df_pct.html deleted file mode 100644 index a2a2bfcc..00000000 --- a/docs/reference/miss_df_pct.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - -Percentage of missing data in a dataframe — miss_df_pct • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Calculate the percent of missing data in a dataframe.

- - -
miss_df_pct(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the percent of missing data in a dataframe

- - -

Examples

-
-miss_df_pct(airquality)
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/miss_prop_summary.html b/docs/reference/miss_prop_summary.html deleted file mode 100644 index da7f2b73..00000000 --- a/docs/reference/miss_prop_summary.html +++ /dev/null @@ -1,132 +0,0 @@ - -Proportions of missings in data, variables, and cases. — miss_prop_summary • naniar - Skip to contents - - -
-
-
- -
-

Return missing data info about the dataframe, the variables, and the cases. -Specifically, returning how many elements in a dataframe contain a missing -value, how many elements in a variable contain a missing value, and how many -elements in a case contain a missing.

-
- -
-

Usage

-
miss_prop_summary(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

a dataframe

-
- - -
-

Examples

-

-miss_prop_summary(airquality)
-#> # A tibble: 1 × 3
-#>       df   var  case
-#>    <dbl> <dbl> <dbl>
-#> 1 0.0479 0.333 0.275
-if (FALSE) {
-library(dplyr)
-# respects dplyr::group_by
-airquality %>% group_by(Month) %>% miss_prop_summary()
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_scan_count.html b/docs/reference/miss_scan_count.html deleted file mode 100644 index f0a30c94..00000000 --- a/docs/reference/miss_scan_count.html +++ /dev/null @@ -1,167 +0,0 @@ - -Search and present different kinds of missing values — miss_scan_count • naniar - Skip to contents - - -
-
-
- -
-

Searching for different kinds of missing values is really annoying. If -you have values like -99 in your data, when they shouldn't be there, -or they should be encoded as missing, it can be difficult to ascertain -if they are there, and if so, where they are. miss_scan_count makes it -easier for users to search for particular occurrences of these values -across their variables.

-
- -
-

Usage

-
miss_scan_count(data, search)
-
- -
-

Arguments

-
data
-

data

- - -
search
-

values to search for

- -
-
-

Value

- - -

a dataframe of the occurrences of the values you searched for

-
- - -
-

Examples

-

-dat_ms <- tibble::tribble(~x,  ~y,    ~z,
-                         1,   "A",   -100,
-                         3,   "N/A", -99,
-                         NA,  NA,    -98,
-                         -99, "E",   -101,
-                         -98, "F",   -1)
-
-miss_scan_count(dat_ms,-99)
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            1
-#> 2 y            0
-#> 3 z            1
-miss_scan_count(dat_ms,c(-99,-98))
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            2
-#> 2 y            0
-#> 3 z            2
-miss_scan_count(dat_ms,c("-99","-98","N/A"))
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            2
-#> 2 y            1
-#> 3 z            2
-miss_scan_count(dat_ms,common_na_strings)
-#> # A tibble: 3 × 2
-#>   Variable     n
-#>   <chr>    <int>
-#> 1 x            4
-#> 2 y            4
-#> 3 z            5
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_summary.html b/docs/reference/miss_summary.html deleted file mode 100644 index d6b4504c..00000000 --- a/docs/reference/miss_summary.html +++ /dev/null @@ -1,153 +0,0 @@ - -Collate summary measures from naniar into one tibble — miss_summary • naniar - Skip to contents - - -
-
-
- -
-

miss_summary performs all of the missing data helper summaries and puts -them into lists within a tibble

-
- -
-

Usage

-
miss_summary(data, order = TRUE)
-
- -
-

Arguments

-
data
-

a dataframe

- - -
order
-

whether or not to order the result by n_miss

- -
-
-

Value

- - -

a tibble of missing data summaries

-
- - -
-

Examples

-

-s_miss <- miss_summary(airquality)
-s_miss$miss_df_prop
-#> [1] 0.04793028
-s_miss$miss_case_table
-#> [[1]]
-#> # A tibble: 3 × 3
-#>   n_miss_in_case n_cases pct_cases
-#>            <int>   <int>     <dbl>
-#> 1              0     111     72.5 
-#> 2              1      40     26.1 
-#> 3              2       2      1.31
-#> 
-s_miss$miss_var_summary
-#> [[1]]
-#> # A tibble: 6 × 3
-#>   variable n_miss pct_miss
-#>   <chr>     <int>    <dbl>
-#> 1 Ozone        37    24.2 
-#> 2 Solar.R       7     4.58
-#> 3 Wind          0     0   
-#> 4 Temp          0     0   
-#> 5 Month         0     0   
-#> 6 Day           0     0   
-#> 
-# etc, etc, etc.
-
-if (FALSE) {
-library(dplyr)
-s_miss_group <- group_by(airquality, Month) %>% miss_summary()
-s_miss_group$miss_df_prop
-s_miss_group$miss_case_table
-# etc, etc, etc.
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_var_cumsum.html b/docs/reference/miss_var_cumsum.html deleted file mode 100644 index c5732466..00000000 --- a/docs/reference/miss_var_cumsum.html +++ /dev/null @@ -1,134 +0,0 @@ - -Cumulative sum of the number of missings in each variable — miss_var_cumsum • naniar - Skip to contents - - -
-
-
- -
-

Calculate the cumulative sum of number & percentage of -missingness for each variable.

-
- -
-

Usage

-
miss_var_cumsum(data)
-
- -
-

Arguments

-
data
-

a data.frame

- -
-
-

Value

- - -

a tibble of the cumulative sum of missing data in each variable

-
- - -
-

Examples

-

-miss_var_cumsum(airquality)
-#> # A tibble: 6 × 3
-#>   variable n_miss n_miss_cumsum
-#>   <chr>     <int>         <int>
-#> 1 Ozone        37            37
-#> 2 Solar.R       7            44
-#> 3 Wind          0            44
-#> 4 Temp          0            44
-#> 5 Month         0            44
-#> 6 Day           0            44
-if (FALSE) {
-library(dplyr)
-
-# respects dplyr::group_by
-
-airquality %>%
-  group_by(Month) %>%
-  miss_var_cumsum()
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_var_pct.html b/docs/reference/miss_var_pct.html deleted file mode 100644 index 094d3973..00000000 --- a/docs/reference/miss_var_pct.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - -Percentage of variables containing missings — miss_var_pct • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Calculate the percentage of variables that contain a single missing value.

- -
- -
miss_var_pct(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the percent of variables that contain missing data

- -

See also

- - - - -

Examples

-
-miss_var_pct(riskfactors)
#> [1] 70.58824
miss_var_pct(oceanbuoys)
#> [1] 37.5
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/reference/miss_var_prop.html b/docs/reference/miss_var_prop.html deleted file mode 100644 index fd5267b2..00000000 --- a/docs/reference/miss_var_prop.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - -Proportion of variables containing missings — miss_var_prop • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Calculate the proportion of variables that contain a single missing value.

- -
- -
miss_var_prop(data)
- -

Arguments

- - - - - - -
data

a dataframe

- -

Value

- -

numeric the proportion of variables that contain missing data

- -

See also

- - - - -

Examples

-
-miss_var_prop(riskfactors)
#> [1] 0.7058824
miss_var_prop(oceanbuoys)
#> [1] 0.375
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/reference/miss_var_run-1.png b/docs/reference/miss_var_run-1.png deleted file mode 100644 index 2f4217ed..00000000 Binary files a/docs/reference/miss_var_run-1.png and /dev/null differ diff --git a/docs/reference/miss_var_run-10.png b/docs/reference/miss_var_run-10.png deleted file mode 100644 index fc99c878..00000000 Binary files a/docs/reference/miss_var_run-10.png and /dev/null differ diff --git a/docs/reference/miss_var_run-11.png b/docs/reference/miss_var_run-11.png deleted file mode 100644 index ffcf2296..00000000 Binary files a/docs/reference/miss_var_run-11.png and /dev/null differ diff --git a/docs/reference/miss_var_run-12.png b/docs/reference/miss_var_run-12.png deleted file mode 100644 index fc99c878..00000000 Binary files a/docs/reference/miss_var_run-12.png and /dev/null differ diff --git a/docs/reference/miss_var_run-13.png b/docs/reference/miss_var_run-13.png deleted file mode 100644 index ffcf2296..00000000 Binary files a/docs/reference/miss_var_run-13.png and /dev/null differ diff --git a/docs/reference/miss_var_run-14.png b/docs/reference/miss_var_run-14.png deleted file mode 100644 index fc99c878..00000000 Binary files a/docs/reference/miss_var_run-14.png and /dev/null differ diff --git a/docs/reference/miss_var_run-15.png b/docs/reference/miss_var_run-15.png deleted file mode 100644 index ffcf2296..00000000 Binary files a/docs/reference/miss_var_run-15.png and /dev/null differ diff --git a/docs/reference/miss_var_run-16.png b/docs/reference/miss_var_run-16.png deleted file mode 100644 index fc99c878..00000000 Binary files a/docs/reference/miss_var_run-16.png and /dev/null differ diff --git a/docs/reference/miss_var_run-17.png b/docs/reference/miss_var_run-17.png deleted file mode 100644 index ffcf2296..00000000 Binary files a/docs/reference/miss_var_run-17.png and /dev/null differ diff --git a/docs/reference/miss_var_run-18.png b/docs/reference/miss_var_run-18.png deleted file mode 100644 index fc99c878..00000000 Binary files a/docs/reference/miss_var_run-18.png and /dev/null differ diff --git a/docs/reference/miss_var_run-2.png b/docs/reference/miss_var_run-2.png deleted file mode 100644 index 52b09987..00000000 Binary files a/docs/reference/miss_var_run-2.png and /dev/null differ diff --git a/docs/reference/miss_var_run-3.png b/docs/reference/miss_var_run-3.png deleted file mode 100644 index 78941223..00000000 Binary files a/docs/reference/miss_var_run-3.png and /dev/null differ diff --git a/docs/reference/miss_var_run-4.png b/docs/reference/miss_var_run-4.png deleted file mode 100644 index 2d17f734..00000000 Binary files a/docs/reference/miss_var_run-4.png and /dev/null differ diff --git a/docs/reference/miss_var_run-5.png b/docs/reference/miss_var_run-5.png deleted file mode 100644 index ffcf2296..00000000 Binary files a/docs/reference/miss_var_run-5.png and /dev/null differ diff --git a/docs/reference/miss_var_run-6.png b/docs/reference/miss_var_run-6.png deleted file mode 100644 index fc99c878..00000000 Binary files a/docs/reference/miss_var_run-6.png and /dev/null differ diff --git a/docs/reference/miss_var_run-7.png b/docs/reference/miss_var_run-7.png deleted file mode 100644 index ffcf2296..00000000 Binary files a/docs/reference/miss_var_run-7.png and /dev/null differ diff --git a/docs/reference/miss_var_run-8.png b/docs/reference/miss_var_run-8.png deleted file mode 100644 index fc99c878..00000000 Binary files a/docs/reference/miss_var_run-8.png and /dev/null differ diff --git a/docs/reference/miss_var_run-9.png b/docs/reference/miss_var_run-9.png deleted file mode 100644 index ffcf2296..00000000 Binary files a/docs/reference/miss_var_run-9.png and /dev/null differ diff --git a/docs/reference/miss_var_run.html b/docs/reference/miss_var_run.html deleted file mode 100644 index c6edb793..00000000 --- a/docs/reference/miss_var_run.html +++ /dev/null @@ -1,173 +0,0 @@ - -Find the number of missing and complete values in a single run — miss_var_run • naniar - Skip to contents - - -
-
-
- -
-

It us useful to find the number of missing values that occur in a single run. -The function, miss_var_run(), returns a dataframe with the column names -"run_length" and "is_na", which describe the length of the run, and -whether that run describes a missing value.

-
- -
-

Usage

-
miss_var_run(data, var)
-
- -
-

Arguments

-
data
-

data.frame

- - -
var
-

a bare variable name

- -
-
-

Value

- - -

dataframe with column names "run_length" and "is_na", which describe -the length of the run, and whether that run describes a missing value.

-
- - -
-

Examples

-

-miss_var_run(pedestrian, hourly_counts)
-#> # A tibble: 35 × 2
-#>    run_length is_na   
-#>         <int> <chr>   
-#>  1       6628 complete
-#>  2          1 missing 
-#>  3       5250 complete
-#>  4        624 missing 
-#>  5       3652 complete
-#>  6          1 missing 
-#>  7       1290 complete
-#>  8        744 missing 
-#>  9       7420 complete
-#> 10          1 missing 
-#> # ℹ 25 more rows
-
-if (FALSE) {
-# find the number of runs missing/complete for each month
-library(dplyr)
-
-
-pedestrian %>%
-  group_by(month) %>%
-  miss_var_run(hourly_counts)
-
-library(ggplot2)
-
-# explore the number of missings in a given run
-miss_var_run(pedestrian, hourly_counts) %>%
-  filter(is_na == "missing") %>%
-  count(run_length) %>%
-  ggplot(aes(x = run_length,
-             y = n)) +
-      geom_col()
-
-# look at the number of missing values and the run length of these.
-miss_var_run(pedestrian, hourly_counts) %>%
-  ggplot(aes(x = is_na,
-             y = run_length)) +
-      geom_boxplot()
-
-# using group_by
- pedestrian %>%
-   group_by(month) %>%
-   miss_var_run(hourly_counts)
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_var_span.html b/docs/reference/miss_var_span.html deleted file mode 100644 index 4587388d..00000000 --- a/docs/reference/miss_var_span.html +++ /dev/null @@ -1,175 +0,0 @@ - -Summarise the number of missings for a given repeating span on a variable — miss_var_span • naniar - Skip to contents - - -
-
-
- -
-

To summarise the missing values in a time series object it can be useful to -calculate the number of missing values in a given time period. -miss_var_span takes a data.frame object, a variable, and a span_every -argument and returns a dataframe containing the number of missing values -within each span. When the number of observations isn't a perfect -multiple of the span length, the final span is whatever the last -remainder is. For example, the pedestrian dataset has 37,700 rows. If -the span is set to 4000, then there will be 1700 rows remaining. This can -be provided using modulo (%%): nrow(data) %% 4000. This remainder -number is provided in n_in_span.

-
- -
-

Usage

-
miss_var_span(data, var, span_every)
-
- -
-

Arguments

-
data
-

data.frame

- - -
var
-

bare unquoted variable name of interest.

- - -
span_every
-

integer describing the length of the span to be explored

- -
-
-

Value

- - -

dataframe with variables n_miss, n_complete, prop_miss, and -prop_complete, which describe the number, or proportion of missing or -complete values within that given time span. The final variable, -n_in_span states how many observations are in the span.

-
- - -
-

Examples

-

-miss_var_span(data = pedestrian,
-             var = hourly_counts,
-             span_every = 168)
-#> # A tibble: 225 × 6
-#>    span_counter n_miss n_complete prop_miss prop_complete n_in_span
-#>           <int>  <int>      <int>     <dbl>         <dbl>     <int>
-#>  1            1      0        168         0             1       168
-#>  2            2      0        168         0             1       168
-#>  3            3      0        168         0             1       168
-#>  4            4      0        168         0             1       168
-#>  5            5      0        168         0             1       168
-#>  6            6      0        168         0             1       168
-#>  7            7      0        168         0             1       168
-#>  8            8      0        168         0             1       168
-#>  9            9      0        168         0             1       168
-#> 10           10      0        168         0             1       168
-#> # ℹ 215 more rows
-
-if (FALSE) {
- library(dplyr)
- pedestrian %>%
-   group_by(month) %>%
-     miss_var_span(var = hourly_counts,
-                   span_every = 168)
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_var_summary.html b/docs/reference/miss_var_summary.html deleted file mode 100644 index 65c949ff..00000000 --- a/docs/reference/miss_var_summary.html +++ /dev/null @@ -1,170 +0,0 @@ - -Summarise the missingness in each variable — miss_var_summary • naniar - Skip to contents - - -
-
-
- -
-

Provide a summary for each variable of the number, percent missings, and -cumulative sum of missings of the order of the variables. By default, -it orders by the most missings in each variable.

-
- -
-

Usage

-
miss_var_summary(data, order = FALSE, add_cumsum = FALSE, ...)
-
- -
-

Arguments

-
data
-

a data.frame

- - -
order
-

a logical indicating whether to order the result by n_miss. -Defaults to TRUE. If FALSE, order of variables is the order input.

- - -
add_cumsum
-

logical indicating whether or not to add the cumulative -sum of missings to the data. This can be useful when exploring patterns -of nonresponse. These are calculated as the cumulative sum of the missings -in the variables as they are first presented to the function.

- - -
...
-

extra arguments

- -
-
-

Value

- - -

a tibble of the percent of missing data in each variable

-
-
-

Note

-

n_miss_cumsum is calculated as the cumulative sum of missings in the -variables in the order that they are given in the data when entering -the function

-
- - -
-

Examples

-

-miss_var_summary(airquality)
-#> # A tibble: 6 × 3
-#>   variable n_miss pct_miss
-#>   <chr>     <int>    <dbl>
-#> 1 Ozone        37    24.2 
-#> 2 Solar.R       7     4.58
-#> 3 Wind          0     0   
-#> 4 Temp          0     0   
-#> 5 Month         0     0   
-#> 6 Day           0     0   
-miss_var_summary(oceanbuoys, order = TRUE)
-#> # A tibble: 8 × 3
-#>   variable   n_miss pct_miss
-#>   <chr>       <int>    <dbl>
-#> 1 humidity       93   12.6  
-#> 2 air_temp_c     81   11.0  
-#> 3 sea_temp_c      3    0.408
-#> 4 year            0    0    
-#> 5 latitude        0    0    
-#> 6 longitude       0    0    
-#> 7 wind_ew         0    0    
-#> 8 wind_ns         0    0    
-
-if (FALSE) {
-# works with group_by from dplyr
-library(dplyr)
-airquality %>%
-  group_by(Month) %>%
-  miss_var_summary()
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_var_table.html b/docs/reference/miss_var_table.html deleted file mode 100644 index eb52b4e8..00000000 --- a/docs/reference/miss_var_table.html +++ /dev/null @@ -1,131 +0,0 @@ - -Tabulate the missings in the variables — miss_var_table • naniar - Skip to contents - - -
-
-
- -
-

Provide a tidy table of the number of variables with 0, 1, 2, up to n, -missing values and the proportion of the number of variables those -variables make up.

-
- -
-

Usage

-
miss_var_table(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

a dataframe

-
- - -
-

Examples

-

-miss_var_table(airquality)
-#> # A tibble: 3 × 3
-#>   n_miss_in_var n_vars pct_vars
-#>           <int>  <int>    <dbl>
-#> 1             0      4     66.7
-#> 2             7      1     16.7
-#> 3            37      1     16.7
-if (FALSE) {
-library(dplyr)
-airquality %>%
-  group_by(Month) %>%
-  miss_var_table()
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/miss_var_which.html b/docs/reference/miss_var_which.html deleted file mode 100644 index a0e3645d..00000000 --- a/docs/reference/miss_var_which.html +++ /dev/null @@ -1,122 +0,0 @@ - -Which variables contain missing values? — miss_var_which • naniar - Skip to contents - - -
-
-
- -
-

It can be helpful when writing other functions to just return the names -of the variables that contain missing values. miss_var_which returns a -vector of variable names that contain missings. It will return NULL when -there are no missings.

-
- -
-

Usage

-
miss_var_which(data)
-
- -
-

Arguments

-
data
-

a data.frame

- -
-
-

Value

- - -

character vector of variable names

-
- -
-

Examples

-
miss_var_which(airquality)
-#> [1] "Ozone"   "Solar.R"
-
-miss_var_which(mtcars)
-#> NULL
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/n-var-case-complete.html b/docs/reference/n-var-case-complete.html deleted file mode 100644 index b80808a5..00000000 --- a/docs/reference/n-var-case-complete.html +++ /dev/null @@ -1,120 +0,0 @@ - -The number of variables with complete values — n-var-case-complete • naniar - Skip to contents - - -
-
-
- -
-

This function calculates the number of variables that contain a complete value

-
- -
-

Usage

-
n_var_complete(data)
-
-n_case_complete(data)
-
- -
-

Arguments

-
data
-

data.frame

- -
-
-

Value

- - -

integer number of complete values

-
-
-

See also

- -
- -
-

Examples

-

-# how many variables contain complete values?
-n_var_complete(airquality)
-#> [1] 4
-n_case_complete(airquality)
-#> [1] 111
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/n-var-case-miss.html b/docs/reference/n-var-case-miss.html deleted file mode 100644 index 57dba0fb..00000000 --- a/docs/reference/n-var-case-miss.html +++ /dev/null @@ -1,119 +0,0 @@ - -The number of variables or cases with missing values — n-var-case-miss • naniar - Skip to contents - - -
-
-
- -
-

This function calculates the number of variables or cases that contain a missing value

-
- -
-

Usage

-
n_var_miss(data)
-
-n_case_miss(data)
-
- -
-

Arguments

-
data
-

data.frame

- -
-
-

Value

- - -

integer, number of missings

-
-
-

See also

- -
- -
-

Examples

-
# how many variables contain missing values?
-n_var_miss(airquality)
-#> [1] 2
-n_case_miss(airquality)
-#> [1] 42
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/n_complete.html b/docs/reference/n_complete.html deleted file mode 100644 index e15f4e8c..00000000 --- a/docs/reference/n_complete.html +++ /dev/null @@ -1,113 +0,0 @@ - -Return the number of complete values — n_complete • naniar - Skip to contents - - -
-
-
- -
-

A complement to n_miss

-
- -
-

Usage

-
n_complete(x)
-
- -
-

Arguments

-
x
-

a vector

- -
-
-

Value

- - -

numeric number of complete values

-
- -
-

Examples

-

-n_complete(airquality)
-#> [1] 874
-n_complete(airquality$Ozone)
-#> [1] 116
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/n_complete_row.html b/docs/reference/n_complete_row.html deleted file mode 100644 index cc5b3ac6..00000000 --- a/docs/reference/n_complete_row.html +++ /dev/null @@ -1,122 +0,0 @@ - -Return a vector of the number of complete values in each row — n_complete_row • naniar - Skip to contents - - -
-
-
- -
-

Substitute for rowSums(!is.na(data)) but it also checks if input is NULL or -is a dataframe

-
- -
-

Usage

-
n_complete_row(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

numeric vector of the number of complete values in each row

-
- - -
-

Examples

-

-n_complete_row(airquality)
-#>   [1] 6 6 6 6 4 5 6 6 6 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 4 6 6 6 6 5 5 5 5 5 5
-#>  [38] 6 5 6 6 5 5 6 5 5 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 6 6 6 5 6 6 6 6 6 6 5 6 6
-#>  [75] 5 6 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 6 6 6 5 5 6 6 6 5 6 6 6 6
-#> [112] 6 6 6 5 6 6 6 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
-#> [149] 6 5 6 6 6
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/n_miss.html b/docs/reference/n_miss.html deleted file mode 100644 index 908a70bc..00000000 --- a/docs/reference/n_miss.html +++ /dev/null @@ -1,113 +0,0 @@ - -Return the number of missing values — n_miss • naniar - Skip to contents - - -
-
-
- -
-

Substitute for sum(is.na(data))

-
- -
-

Usage

-
n_miss(x)
-
- -
-

Arguments

-
x
-

a vector

- -
-
-

Value

- - -

numeric the number of missing values

-
- -
-

Examples

-

-n_miss(airquality)
-#> [1] 44
-n_miss(airquality$Ozone)
-#> [1] 37
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/n_miss_row.html b/docs/reference/n_miss_row.html deleted file mode 100644 index daf841d1..00000000 --- a/docs/reference/n_miss_row.html +++ /dev/null @@ -1,122 +0,0 @@ - -Return a vector of the number of missing values in each row — n_miss_row • naniar - Skip to contents - - -
-
-
- -
-

Substitute for rowSums(is.na(data)), but it also checks if input is NULL or -is a dataframe

-
- -
-

Usage

-
n_miss_row(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

numeric vector of the number of missing values in each row

-
- - -
-

Examples

-

-n_miss_row(airquality)
-#>   [1] 0 0 0 0 2 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 0 0 0 0 1 1 1 1 1 1
-#>  [38] 0 1 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 0 0 1 0 0
-#>  [75] 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 0 0 1 0 0 0 0
-#> [112] 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-#> [149] 0 1 0 0 0
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/nabular.html b/docs/reference/nabular.html deleted file mode 100644 index 2acd3c94..00000000 --- a/docs/reference/nabular.html +++ /dev/null @@ -1,134 +0,0 @@ - -Convert data into nabular form by binding shade to it — nabular • naniar - Skip to contents - - -
-
-
- -
-

Binding a shadow matrix to a regular dataframe converts it into nabular data, -which makes it easier to visualise and work with missing data.

-
- -
-

Usage

-
nabular(data, only_miss = FALSE, ...)
-
- -
-

Arguments

-
data
-

a dataframe

- - -
only_miss
-

logical - if FALSE (default) it will bind a dataframe with -all of the variables duplicated with their shadow. Setting this to TRUE -will bind variables only those variables that contain missing values. -See the examples for more details.

- - -
...
-

extra options to pass to recode_shadow() - a work in progress.

- -
-
-

Value

- - -

data with the added variable shifted and the suffix _NA

- - -
-
-

See also

- -
- -
-

Examples

-

-aq_nab <- nabular(airquality)
-aq_s <- bind_shadow(airquality)
-
-all.equal(aq_nab, aq_s)
-#> [1] TRUE
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/naniar-ggproto.html b/docs/reference/naniar-ggproto.html deleted file mode 100644 index c2679ed4..00000000 --- a/docs/reference/naniar-ggproto.html +++ /dev/null @@ -1,98 +0,0 @@ - -naniar-ggproto — GeomMissPoint • naniar - Skip to contents - - -
-
-
- -
-

These are the stat and geom overrides using ggproto from ggplot2 -that make naniar work.

-
- -
-

Usage

-
StatMissPoint
-
- -
-

Format

-

An object of class StatMissPoint (inherits from Stat, ggproto, gg) of length 6.

-
- -
- - -
- - - - - - - diff --git a/docs/reference/naniar.html b/docs/reference/naniar.html deleted file mode 100644 index cc9041d0..00000000 --- a/docs/reference/naniar.html +++ /dev/null @@ -1,99 +0,0 @@ - -naniar — naniar • naniar - Skip to contents - - -
- - - -
- - - - - - - diff --git a/docs/reference/narnia-ggproto.html b/docs/reference/narnia-ggproto.html deleted file mode 100644 index a1841c36..00000000 --- a/docs/reference/narnia-ggproto.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - -narnia-ggroto — GeomMissingPoint • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

These are the stat and geom overrides using ggproto from ggplot2 that make narnia work.

- - -
StatMissingPoint
- -

Format

- -

An object of class StatMissingPoint (inherits from Stat, ggproto, gg) of length 6.

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/narnia.html b/docs/reference/narnia.html deleted file mode 100644 index 3ab3089a..00000000 --- a/docs/reference/narnia.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - -narnia — narnia • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

narnia is a package to make it easier to summarise and handle missing values -in R. It strives to do this in a way that is as consistent with tidyverse -principles as possible.

- - - - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/new_nabular.html b/docs/reference/new_nabular.html deleted file mode 100644 index 1705acf9..00000000 --- a/docs/reference/new_nabular.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - -Create a new nabular format — new_nabular • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Create a new nabular format

-
- -
new_nabular(x)
- -

Arguments

- - - - - - -
x

a data.frame

- -

Value

- -

object with class "nabular", inheriting from it's original class

- -
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/new_shade.html b/docs/reference/new_shade.html deleted file mode 100644 index 7defc230..00000000 --- a/docs/reference/new_shade.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - -Create a new shade factor — new_shade • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Create a new shade factor

-
- -
new_shade(x, extra_levels = NULL)
- -

Arguments

- - - - - - - - - - -
x

a factor to convert into a shade object

extra_levels

the extra levels to give to shade objects, such as "broken_machine" and so on, which get converted into "NA_broken_machine".

- -

Value

- -

a new shade, which is built upon a factor

- -
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/new_shadow.html b/docs/reference/new_shadow.html deleted file mode 100644 index 0a5c19a9..00000000 --- a/docs/reference/new_shadow.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - -Create a new shadow — new_shadow • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Create a new shadow

-
- -
new_shadow(x)
- -

Arguments

- - - - - - -
x

a data.frame

- -

Value

- -

object with class "shadow", inheriting from it's original class

- -
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/oceanbuoys-1.png b/docs/reference/oceanbuoys-1.png deleted file mode 100644 index 91fadea2..00000000 Binary files a/docs/reference/oceanbuoys-1.png and /dev/null differ diff --git a/docs/reference/oceanbuoys-2.png b/docs/reference/oceanbuoys-2.png deleted file mode 100644 index 22a549d6..00000000 Binary files a/docs/reference/oceanbuoys-2.png and /dev/null differ diff --git a/docs/reference/oceanbuoys-3.png b/docs/reference/oceanbuoys-3.png deleted file mode 100644 index 37f22206..00000000 Binary files a/docs/reference/oceanbuoys-3.png and /dev/null differ diff --git a/docs/reference/oceanbuoys-4.png b/docs/reference/oceanbuoys-4.png deleted file mode 100644 index aaef2a64..00000000 Binary files a/docs/reference/oceanbuoys-4.png and /dev/null differ diff --git a/docs/reference/oceanbuoys-5.png b/docs/reference/oceanbuoys-5.png deleted file mode 100644 index 431d939c..00000000 Binary files a/docs/reference/oceanbuoys-5.png and /dev/null differ diff --git a/docs/reference/oceanbuoys.html b/docs/reference/oceanbuoys.html deleted file mode 100644 index 53981788..00000000 --- a/docs/reference/oceanbuoys.html +++ /dev/null @@ -1,190 +0,0 @@ - -West Pacific Tropical Atmosphere Ocean Data, 1993 & 1997. — oceanbuoys • naniar - Skip to contents - - -
-
-
- -
-

Real-time data from moored ocean buoys for improved detection, understanding -and prediction of El Ni'o and La Ni'a. The data is collected by the -Tropical Atmosphere Ocean project -(https://www.pmel.noaa.gov/gtmba/pmel-theme/pacific-ocean-tao).

-
- -
-

Usage

-
data(oceanbuoys)
-
- -
-

Format

-

An object of class tbl_df (inherits from tbl, data.frame) with 736 rows and 8 columns.

-
- -
-

Details

-

Format: a data frame with 736 observations on the following 8 -variables.

year
-

A numeric with levels 1993 1997.

- -
latitude
-

A numeric with levels -5 -2 0.

- -
longitude
-

A numeric with levels -110 -95.

- -
sea_temp_c
-

Sea surface temperature(degree Celsius), measured -by the TAO buoys at one meter below the surface.

- -
air_temp_c
-

Air temperature(degree Celsius), measured by the -TAO buoys three meters above the sea surface.

- -
humidity
-

Relative humidity(%), measured by the TAO buoys 3 -meters above the sea surface.

- -
wind_ew
-

The East-West wind vector components(M/s). TAO buoys -measure the wind speed and direction four meters above the sea surface. -If it is positive, the East-West component of the wind is blowing towards -the East. If it is negative, this component is blowing towards the West.

- -
wind_ns
-

The North-South wind vector components(M/s). TAO -buoys measure the wind speed and direction four meters above the sea -surface. If it is positive, the North-South component of the wind is -blowing towards the North. If it is negative, this component is blowing -towards the South.

- -
-
-

See also

-

library(MissingDataGUI) (data named "tao")

-
- -
-

Examples

-

-vis_miss(oceanbuoys)
-
-
-# Look at the missingness in the variables
-miss_var_summary(oceanbuoys)
-#> # A tibble: 8 × 3
-#>   variable   n_miss pct_miss
-#>   <chr>       <int>    <dbl>
-#> 1 humidity       93   12.6  
-#> 2 air_temp_c     81   11.0  
-#> 3 sea_temp_c      3    0.408
-#> 4 year            0    0    
-#> 5 latitude        0    0    
-#> 6 longitude       0    0    
-#> 7 wind_ew         0    0    
-#> 8 wind_ns         0    0    
-if (FALSE) {
-# Look at the missingness in air temperature and humidity
-library(ggplot2)
-p <-
-ggplot(oceanbuoys,
-       aes(x = air_temp_c,
-           y = humidity)) +
-     geom_miss_point()
-
- p
-
- # for each year?
- p + facet_wrap(~year)
-
- # this shows that there are more missing values in humidity in 1993, and
- # more air temperature missing values in 1997
-
- # see more examples in the vignette, "getting started with naniar".
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/pct-miss-complete-case.html b/docs/reference/pct-miss-complete-case.html deleted file mode 100644 index 0c0e0c33..00000000 --- a/docs/reference/pct-miss-complete-case.html +++ /dev/null @@ -1,123 +0,0 @@ - -Percentage of cases that contain a missing or complete values. — pct-miss-complete-case • naniar - Skip to contents - - -
-
-
- -
-

Calculate the percentage of cases (rows) that contain a missing or complete -value.

-
- -
-

Usage

-
pct_miss_case(data)
-
-pct_complete_case(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

numeric the percentage of cases that contain a missing or complete -value

-
- - -
-

Examples

-

-pct_miss_case(airquality)
-#> [1] 27.45098
-pct_complete_case(airquality)
-#> [1] 72.54902
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/pct-miss-complete-var.html b/docs/reference/pct-miss-complete-var.html deleted file mode 100644 index 27d43daf..00000000 --- a/docs/reference/pct-miss-complete-var.html +++ /dev/null @@ -1,123 +0,0 @@ - -Percentage of variables containing missings or complete values — pct-miss-complete-var • naniar - Skip to contents - - -
-
-
- -
-

Calculate the percentage of variables that contain a single missing or -complete value.

-
- -
-

Usage

-
pct_miss_var(data)
-
-pct_complete_var(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

numeric the percent of variables that contain missing or complete -data

-
- - -
-

Examples

-

-prop_miss_var(airquality)
-#> [1] 0.3333333
-prop_complete_var(airquality)
-#> [1] 0.6666667
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/pct_complete.html b/docs/reference/pct_complete.html deleted file mode 100644 index 1333d3d0..00000000 --- a/docs/reference/pct_complete.html +++ /dev/null @@ -1,113 +0,0 @@ - -Return the percent of complete values — pct_complete • naniar - Skip to contents - - -
-
-
- -
-

The complement to pct_miss

-
- -
-

Usage

-
pct_complete(x)
-
- -
-

Arguments

-
x
-

vector or data.frame

- -
-
-

Value

- - -

numeric percent of complete values

-
- -
-

Examples

-

-pct_complete(airquality)
-#> [1] 95.20697
-pct_complete(airquality$Ozone)
-#> [1] 75.81699
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/pct_miss.html b/docs/reference/pct_miss.html deleted file mode 100644 index 29cd3034..00000000 --- a/docs/reference/pct_miss.html +++ /dev/null @@ -1,113 +0,0 @@ - -Return the percent of missing values — pct_miss • naniar - Skip to contents - - -
-
-
- -
-

This is shorthand for mean(is.na(x)) * 100

-
- -
-

Usage

-
pct_miss(x)
-
- -
-

Arguments

-
x
-

vector or data.frame

- -
-
-

Value

- - -

numeric the percent of missing values in x

-
- -
-

Examples

-

-pct_miss(airquality)
-#> [1] 4.793028
-pct_miss(airquality$Ozone)
-#> [1] 24.18301
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/pedestrian-1.png b/docs/reference/pedestrian-1.png deleted file mode 100644 index 9dce4438..00000000 Binary files a/docs/reference/pedestrian-1.png and /dev/null differ diff --git a/docs/reference/pedestrian-2.png b/docs/reference/pedestrian-2.png deleted file mode 100644 index 6e7a9ae9..00000000 Binary files a/docs/reference/pedestrian-2.png and /dev/null differ diff --git a/docs/reference/pedestrian.html b/docs/reference/pedestrian.html deleted file mode 100644 index bf3e156e..00000000 --- a/docs/reference/pedestrian.html +++ /dev/null @@ -1,171 +0,0 @@ - -Pedestrian count information around Melbourne for 2016 — pedestrian • naniar - Skip to contents - - -
-
-
- -
-

This dataset contains hourly counts of pedestrians from 4 sensors around -Melbourne: Birrarung Marr, Bourke Street Mall, Flagstaff station, and -Spencer St-Collins St (south), recorded from January 1st 2016 at 00:00:00 -to December 31st 2016 at 23:00:00. The data is made free and publicly -available from https://data.melbourne.vic.gov.au/explore/dataset/pedestrian-counting-system-monthly-counts-per-hour/information/

-
- -
-

Usage

-
data(pedestrian)
-
- -
-

Format

-

A tibble with 37,700 rows and 9 variables:

hourly_counts
-

(integer) the number of pedestrians counted at that sensor -at that time

- -
date_time
-

(POSIXct, POSIXt) The time that the count was taken

- -
year
-

(integer) Year of record

- -
month
-

(factor) Month of record as an ordered factor (1 = January, 12 = -December)

- -
month_day
-

(integer) Full day of the month

- -
week_day
-

(factor) Full day of the week as an ordered factor (1 = Sunday, -7 = Saturday)

- -
hour
-

(integer) The hour of the day in 24 hour format

- -
sensor_id
-

(integer) the id of the sensor

- -
sensor_name
-

(character) the full name of the sensor

- - -
- - -
-

Examples

-
# explore the missingness with vis_miss
-
-vis_miss(pedestrian)
-
-
-# Look at the missingness in the variables
-miss_var_summary(pedestrian)
-#> # A tibble: 9 × 3
-#>   variable      n_miss pct_miss
-#>   <chr>          <int>    <dbl>
-#> 1 hourly_counts   2548     6.76
-#> 2 date_time          0     0   
-#> 3 year               0     0   
-#> 4 month              0     0   
-#> 5 month_day          0     0   
-#> 6 week_day           0     0   
-#> 7 hour               0     0   
-#> 8 sensor_id          0     0   
-#> 9 sensor_name        0     0   
-
-if (FALSE) {
-# There is only missingness in hourly_counts
-# Look at the missingness over a rolling window
-library(ggplot2)
-gg_miss_span(pedestrian, hourly_counts, span_every = 3000)
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/percent_missing_case.html b/docs/reference/percent_missing_case.html deleted file mode 100644 index 34d1b9a2..00000000 --- a/docs/reference/percent_missing_case.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - -Percentage of cases that contain a missing values. — percent_missing_case • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Deprecated as of version 0.0.6.9000. Please use miss_case_pct instead.

- - -
percent_missing_case(...)
- -

Arguments

- - - - - - -
...

so that users can still receive meaningful error

- -

See also

- -

miss_case_pct

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/percent_missing_df.html b/docs/reference/percent_missing_df.html deleted file mode 100644 index cd66f1d7..00000000 --- a/docs/reference/percent_missing_df.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - -Percentage of missing data in a dataframe — percent_missing_df • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Deprecated as of version 0.0.6.9000. Please use miss_df_pct instead.

- - -
percent_missing_df(...)
- -

Arguments

- - - - - - -
...

so that users can still receive meaningful error

- -

See also

- -

miss_df_pct

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/percent_missing_var.html b/docs/reference/percent_missing_var.html deleted file mode 100644 index 9ce347f0..00000000 --- a/docs/reference/percent_missing_var.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - -Percentage of variables containing missings — percent_missing_var • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Deprecated as of version 0.0.6.9000. Please use miss_var_pct instead.

- - -
percent_missing_var(...)
- -

Arguments

- - - - - - -
...

so that users can still receive meaningful error

- -

See also

- -

miss_var_pct

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/plotly_helpers.html b/docs/reference/plotly_helpers.html deleted file mode 100644 index 1f4dede3..00000000 --- a/docs/reference/plotly_helpers.html +++ /dev/null @@ -1,130 +0,0 @@ - -Plotly helpers (Convert a geom to a "basic" geom.) — plotly_helpers • naniar - Skip to contents - - -
-
-
- -
-

Helper functions to make it easier to automatically create -plotly charts. This function makes it possible to convert ggplot2 geoms -that are not included with ggplot2 itself. Users shouldn't need to use this -function. It exists purely to allow other package authors to write their -own conversion method(s).

-
- -
-

Usage

-
to_basic.GeomMissPoint(data, prestats_data, layout, params, p, ...)
-
- -
-

Arguments

-
data
-

the data returned by ggplot2::ggplot_build().

- - -
prestats_data
-

the data before statistics are computed.

- - -
layout
-

the panel layout.

- - -
params
-

parameters for the geom, statistic, and 'constant' aesthetics

- - -
p
-

a ggplot2 object (the conversion may depend on scales, for -instance).

- - -
...
-

currently ignored

- -
- -
- - -
- - - - - - - diff --git a/docs/reference/prop-miss-complete-case.html b/docs/reference/prop-miss-complete-case.html deleted file mode 100644 index a3a95aa2..00000000 --- a/docs/reference/prop-miss-complete-case.html +++ /dev/null @@ -1,123 +0,0 @@ - -Proportion of cases that contain a missing or complete values. — prop-miss-complete-case • naniar - Skip to contents - - -
-
-
- -
-

Calculate the proportion of cases (rows) that contain missing or complete -values.

-
- -
-

Usage

-
prop_miss_case(data)
-
-prop_complete_case(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

numeric the proportion of cases that contain a missing or complete -value

-
- - -
-

Examples

-

-prop_miss_case(airquality)
-#> [1] 0.2745098
-prop_complete_case(airquality)
-#> [1] 0.7254902
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/prop-miss-complete-var.html b/docs/reference/prop-miss-complete-var.html deleted file mode 100644 index 07d032f3..00000000 --- a/docs/reference/prop-miss-complete-var.html +++ /dev/null @@ -1,123 +0,0 @@ - -Proportion of variables containing missings or complete values — prop-miss-complete-var • naniar - Skip to contents - - -
-
-
- -
-

Calculate the proportion of variables that contain a single missing or -complete values.

-
- -
-

Usage

-
prop_miss_var(data)
-
-prop_complete_var(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

numeric the proportion of variables that contain missing or complete -data

-
- - -
-

Examples

-

-prop_miss_var(airquality)
-#> [1] 0.3333333
-prop_complete_var(airquality)
-#> [1] 0.6666667
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/prop_complete.html b/docs/reference/prop_complete.html deleted file mode 100644 index 47392f14..00000000 --- a/docs/reference/prop_complete.html +++ /dev/null @@ -1,113 +0,0 @@ - -Return the proportion of complete values — prop_complete • naniar - Skip to contents - - -
-
-
- -
-

The complement to prop_miss

-
- -
-

Usage

-
prop_complete(x)
-
- -
-

Arguments

-
x
-

vector or data.frame

- -
-
-

Value

- - -

numeric proportion of complete values

-
- -
-

Examples

-

-prop_complete(airquality)
-#> [1] 0.9520697
-prop_complete(airquality$Ozone)
-#> [1] 0.7581699
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/prop_complete_row.html b/docs/reference/prop_complete_row.html deleted file mode 100644 index 4865a98e..00000000 --- a/docs/reference/prop_complete_row.html +++ /dev/null @@ -1,139 +0,0 @@ - -Return a vector of the proportion of missing values in each row — prop_complete_row • naniar - Skip to contents - - -
-
-
- -
-

Substitute for rowMeans(!is.na(data)), but it also checks if input is NULL or -is a dataframe

-
- -
-

Usage

-
prop_complete_row(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

numeric vector of the proportion of missing values in each row

-
- - -
-

Examples

-

-prop_complete_row(airquality)
-#>   [1] 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 0.8333333 1.0000000
-#>   [8] 1.0000000 1.0000000 0.8333333 0.8333333 1.0000000 1.0000000 1.0000000
-#>  [15] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
-#>  [22] 1.0000000 1.0000000 1.0000000 0.8333333 0.8333333 0.6666667 1.0000000
-#>  [29] 1.0000000 1.0000000 1.0000000 0.8333333 0.8333333 0.8333333 0.8333333
-#>  [36] 0.8333333 0.8333333 1.0000000 0.8333333 1.0000000 1.0000000 0.8333333
-#>  [43] 0.8333333 1.0000000 0.8333333 0.8333333 1.0000000 1.0000000 1.0000000
-#>  [50] 1.0000000 1.0000000 0.8333333 0.8333333 0.8333333 0.8333333 0.8333333
-#>  [57] 0.8333333 0.8333333 0.8333333 0.8333333 0.8333333 1.0000000 1.0000000
-#>  [64] 1.0000000 0.8333333 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
-#>  [71] 1.0000000 0.8333333 1.0000000 1.0000000 0.8333333 1.0000000 1.0000000
-#>  [78] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.8333333 0.8333333
-#>  [85] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
-#>  [92] 1.0000000 1.0000000 1.0000000 1.0000000 0.8333333 0.8333333 0.8333333
-#>  [99] 1.0000000 1.0000000 1.0000000 0.8333333 0.8333333 1.0000000 1.0000000
-#> [106] 1.0000000 0.8333333 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
-#> [113] 1.0000000 1.0000000 0.8333333 1.0000000 1.0000000 1.0000000 0.8333333
-#> [120] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
-#> [127] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
-#> [134] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
-#> [141] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
-#> [148] 1.0000000 1.0000000 0.8333333 1.0000000 1.0000000 1.0000000
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/prop_miss.html b/docs/reference/prop_miss.html deleted file mode 100644 index 545dfbe4..00000000 --- a/docs/reference/prop_miss.html +++ /dev/null @@ -1,113 +0,0 @@ - -Return the proportion of missing values — prop_miss • naniar - Skip to contents - - -
-
-
- -
-

This is shorthand for mean(is.na(x))

-
- -
-

Usage

-
prop_miss(x)
-
- -
-

Arguments

-
x
-

vector or data.frame

- -
-
-

Value

- - -

numeric the proportion of missing values in x

-
- -
-

Examples

-

-prop_miss(airquality)
-#> [1] 0.04793028
-prop_miss(airquality$Ozone)
-#> [1] 0.2418301
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/prop_miss_row.html b/docs/reference/prop_miss_row.html deleted file mode 100644 index e4d756c2..00000000 --- a/docs/reference/prop_miss_row.html +++ /dev/null @@ -1,139 +0,0 @@ - -Return a vector of the proportion of missing values in each row — prop_miss_row • naniar - Skip to contents - - -
-
-
- -
-

Substitute for rowMeans(is.na(data)), but it also checks if input is NULL or -is a dataframe

-
- -
-

Usage

-
prop_miss_row(data)
-
- -
-

Arguments

-
data
-

a dataframe

- -
-
-

Value

- - -

numeric vector of the proportion of missing values in each row

-
- - -
-

Examples

-

-prop_miss_row(airquality)
-#>   [1] 0.0000000 0.0000000 0.0000000 0.0000000 0.3333333 0.1666667 0.0000000
-#>   [8] 0.0000000 0.0000000 0.1666667 0.1666667 0.0000000 0.0000000 0.0000000
-#>  [15] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
-#>  [22] 0.0000000 0.0000000 0.0000000 0.1666667 0.1666667 0.3333333 0.0000000
-#>  [29] 0.0000000 0.0000000 0.0000000 0.1666667 0.1666667 0.1666667 0.1666667
-#>  [36] 0.1666667 0.1666667 0.0000000 0.1666667 0.0000000 0.0000000 0.1666667
-#>  [43] 0.1666667 0.0000000 0.1666667 0.1666667 0.0000000 0.0000000 0.0000000
-#>  [50] 0.0000000 0.0000000 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667
-#>  [57] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667 0.0000000 0.0000000
-#>  [64] 0.0000000 0.1666667 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
-#>  [71] 0.0000000 0.1666667 0.0000000 0.0000000 0.1666667 0.0000000 0.0000000
-#>  [78] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.1666667 0.1666667
-#>  [85] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
-#>  [92] 0.0000000 0.0000000 0.0000000 0.0000000 0.1666667 0.1666667 0.1666667
-#>  [99] 0.0000000 0.0000000 0.0000000 0.1666667 0.1666667 0.0000000 0.0000000
-#> [106] 0.0000000 0.1666667 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
-#> [113] 0.0000000 0.0000000 0.1666667 0.0000000 0.0000000 0.0000000 0.1666667
-#> [120] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
-#> [127] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
-#> [134] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
-#> [141] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
-#> [148] 0.0000000 0.0000000 0.1666667 0.0000000 0.0000000 0.0000000
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/recode_shadow.html b/docs/reference/recode_shadow.html deleted file mode 100644 index 3ae2b24f..00000000 --- a/docs/reference/recode_shadow.html +++ /dev/null @@ -1,157 +0,0 @@ - -Add special missing values to the shadow matrix — recode_shadow • naniar - Skip to contents - - -
-
-
- -
-

It can be useful to add special missing values, naniar supports this with -the recode_shadow function.

-
- -
-

Usage

-
recode_shadow(data, ...)
-
-# S3 method for data.frame
-recode_shadow(data, ...)
-
-# S3 method for grouped_df
-recode_shadow(data, ...)
-
- -
-

Arguments

-
data
-

data.frame

- - -
...
-

A sequence of two-sided formulas as in dplyr::case_when, -but when a wrapper function .where written around it.

- -
-
-

Value

- - -

a dataframe with altered shadows

-
- -
-

Examples

-

-df <- tibble::tribble(
-~wind, ~temp,
--99,    45,
-68,    NA,
-72,    25
-)
-
-dfs <- bind_shadow(df)
-
-dfs
-#> # A tibble: 3 × 4
-#>    wind  temp wind_NA temp_NA
-#>   <dbl> <dbl> <fct>   <fct>  
-#> 1   -99    45 !NA     !NA    
-#> 2    68    NA !NA     NA     
-#> 3    72    25 !NA     !NA    
-
-recode_shadow(dfs, temp = .where(wind == -99 ~ "bananas"))
-#> # A tibble: 3 × 4
-#>    wind  temp wind_NA temp_NA   
-#>   <dbl> <dbl> <fct>   <fct>     
-#> 1   -99    45 !NA     NA_bananas
-#> 2    68    NA !NA     NA        
-#> 3    72    25 !NA     !NA       
-
-recode_shadow(dfs,
-              temp = .where(wind == -99 ~ "bananas")) %>%
-recode_shadow(wind = .where(wind == -99 ~ "apples"))
-#> # A tibble: 3 × 4
-#>    wind  temp wind_NA   temp_NA   
-#>   <dbl> <dbl> <fct>     <fct>     
-#> 1   -99    45 NA_apples NA_bananas
-#> 2    68    NA !NA       NA        
-#> 3    72    25 !NA       !NA       
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html deleted file mode 100644 index 8cf341f6..00000000 --- a/docs/reference/reexports.html +++ /dev/null @@ -1,129 +0,0 @@ - -Objects exported from other packages — reexports • naniar - Skip to contents - - -
-
-
- -
-

These objects are imported from other packages. Follow the links -below to see their documentation.

-
magrittr
-

%>%

- - -
rlang
-

are_na, is_na

- - -
visdat
-

vis_miss

- - -
- - - -
- - -
- - - - - - - diff --git a/docs/reference/replace_to_na.html b/docs/reference/replace_to_na.html deleted file mode 100644 index 5b3d69a4..00000000 --- a/docs/reference/replace_to_na.html +++ /dev/null @@ -1,103 +0,0 @@ - -Replace values with missings — replace_to_na • naniar - Skip to contents - - -
-
-
- -
-

This function is Defunct, please see replace_with_na().

-
- -
-

Usage

-
replace_to_na(...)
-
- -
-

Arguments

-
...
-

additional arguments for methods.

- -
-
-

Value

- - -

values replaced by NA

-
- -
- - -
- - - - - - - diff --git a/docs/reference/replace_with_na.html b/docs/reference/replace_with_na.html deleted file mode 100644 index 151adb97..00000000 --- a/docs/reference/replace_with_na.html +++ /dev/null @@ -1,164 +0,0 @@ - -Replace values with missings — replace_with_na • naniar - Skip to contents - - -
-
-
- -
-

Specify variables and their values that you want to convert to missing values. -This is a complement to tidyr::replace_na.

-
- -
-

Usage

-
replace_with_na(data, replace = list(), ...)
-
- -
-

Arguments

-
data
-

A data.frame

- - -
replace
-

A named list given the NA to replace values for each column

- - -
...
-

additional arguments for methods. Currently unused

- -
-
-

Value

- - -

Dataframe with values replaced by NA.

-
- - -
-

Examples

-

-dat_ms <- tibble::tribble(~x,  ~y,    ~z,
-                         1,   "A",   -100,
-                         3,   "N/A", -99,
-                         NA,  NA,    -98,
-                         -99, "E",   -101,
-                         -98, "F",   -1)
-
-replace_with_na(dat_ms,
-               replace = list(x = -99))
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A     -99
-#> 3    NA NA      -98
-#> 4    NA E      -101
-#> 5   -98 F        -1
-
-replace_with_na(dat_ms,
-             replace = list(x = c(-99, -98)))
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A     -99
-#> 3    NA NA      -98
-#> 4    NA E      -101
-#> 5    NA F        -1
-
-replace_with_na(dat_ms,
-             replace = list(x = c(-99, -98),
-                          y = c("N/A"),
-                          z = c(-101)))
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 NA      -99
-#> 3    NA NA      -98
-#> 4    NA E        NA
-#> 5    NA F        -1
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/replace_with_na_all.html b/docs/reference/replace_with_na_all.html deleted file mode 100644 index aa3865f7..00000000 --- a/docs/reference/replace_with_na_all.html +++ /dev/null @@ -1,179 +0,0 @@ - -Replace all values with NA where a certain condition is met — replace_with_na_all • naniar - Skip to contents - - -
-
-
- -
-

This function takes a dataframe and replaces all values that meet the -condition specified as an NA value, following a special syntax.

-
- -
-

Usage

-
replace_with_na_all(data, condition)
-
- -
-

Arguments

-
data
-

A dataframe

- - -
condition
-

A condition required to be TRUE to set NA. Here, the condition -is specified with a formula, following the syntax: ~.x {condition}. -For example, writing ~.x < 20 would mean "where a variable value is less -than 20, replace with NA".

- -
- -
-

Examples

-
dat_ms <- tibble::tribble(~x,  ~y,    ~z,
-                          1,   "A",   -100,
-                          3,   "N/A", -99,
-                          NA,  NA,    -98,
-                          -99, "E",   -101,
-                          -98, "F",   -1)
-
-dat_ms
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A     -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-#replace all instances of -99 with NA
-replace_with_na_all(data = dat_ms,
-                    condition = ~.x == -99)
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A      NA
-#> 3    NA NA      -98
-#> 4    NA E      -101
-#> 5   -98 F        -1
-
-# replace all instances of -99 or -98, or "N/A" with NA
-replace_with_na_all(dat_ms,
-                    condition = ~.x %in% c(-99, -98, "N/A"))
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 NA       NA
-#> 3    NA NA       NA
-#> 4    NA E      -101
-#> 5    NA F        -1
-# replace all instances of common na strings
-replace_with_na_all(dat_ms,
-                    condition = ~.x %in% common_na_strings)
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 NA      -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-
-# where works with functions
-replace_with_na_all(airquality, ~ sqrt(.x) < 5)
-#> # A tibble: 153 × 6
-#>    Ozone Solar.R  Wind  Temp Month   Day
-#>    <int>   <int> <dbl> <int> <int> <int>
-#>  1    41     190    NA    67    NA    NA
-#>  2    36     118    NA    72    NA    NA
-#>  3    NA     149    NA    74    NA    NA
-#>  4    NA     313    NA    62    NA    NA
-#>  5    NA      NA    NA    56    NA    NA
-#>  6    28      NA    NA    66    NA    NA
-#>  7    NA     299    NA    65    NA    NA
-#>  8    NA      99    NA    59    NA    NA
-#>  9    NA      NA    NA    61    NA    NA
-#> 10    NA     194    NA    69    NA    NA
-#> # ℹ 143 more rows
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/replace_with_na_at.html b/docs/reference/replace_with_na_at.html deleted file mode 100644 index 7d625966..00000000 --- a/docs/reference/replace_with_na_at.html +++ /dev/null @@ -1,174 +0,0 @@ - -Replace specified variables with NA where a certain condition is met — replace_with_na_at • naniar - Skip to contents - - -
-
-
- -
-

Replace specified variables with NA where a certain condition is met

-
- -
-

Usage

-
replace_with_na_at(data, .vars, condition)
-
- -
-

Arguments

-
data
-

dataframe

- - -
.vars
-

A character string of variables to replace with NA values

- - -
condition
-

A condition required to be TRUE to set NA. Here, the condition -is specified with a formula, following the syntax: ~.x {condition}. -For example, writing ~.x < 20 would mean "where a variable value is less -than 20, replace with NA".

- -
-
-

Value

- - -

a dataframe

-
- -
-

Examples

-

-dat_ms <- tibble::tribble(~x,  ~y,    ~z,
-                          1,   "A",   -100,
-                          3,   "N/A", -99,
-                          NA,  NA,    -98,
-                          -99, "E",   -101,
-                          -98, "F",   -1)
-
-dat_ms
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A     -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-
-replace_with_na_at(data = dat_ms,
-                 .vars = "x",
-                 condition = ~.x == -99)
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A     -99
-#> 3    NA NA      -98
-#> 4    NA E      -101
-#> 5   -98 F        -1
-
-replace_with_na_at(data = dat_ms,
-                 .vars = c("x","z"),
-                 condition = ~.x == -99)
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A      NA
-#> 3    NA NA      -98
-#> 4    NA E      -101
-#> 5   -98 F        -1
-
-# replace using values in common_na_strings
-replace_with_na_at(data = dat_ms,
-                 .vars = c("x","z"),
-                 condition = ~.x %in% common_na_strings)
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A     -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/replace_with_na_if.html b/docs/reference/replace_with_na_if.html deleted file mode 100644 index 1342ef88..00000000 --- a/docs/reference/replace_with_na_if.html +++ /dev/null @@ -1,174 +0,0 @@ - -Replace values with NA based on some condition, for variables that meet some predicate — replace_with_na_if • naniar - Skip to contents - - -
-
-
- -
-

Replace values with NA based on some condition, for variables that meet some predicate

-
- -
-

Usage

-
replace_with_na_if(data, .predicate, condition)
-
- -
-

Arguments

-
data
-

Dataframe

- - -
.predicate
-

A predicate function to be applied to the columns or a -logical vector.

- - -
condition
-

A condition required to be TRUE to set NA. Here, the condition -is specified with a formula, following the syntax: ~.x {condition}. -For example, writing ~.x < 20 would mean "where a variable value is less -than 20, replace with NA".

- -
-
-

Value

- - -

Dataframe

-
- -
-

Examples

-

-dat_ms <- tibble::tribble(~x,  ~y,    ~z,
-                          1,   "A",   -100,
-                          3,   "N/A", -99,
-                          NA,  NA,    -98,
-                          -99, "E",   -101,
-                          -98, "F",   -1)
-
-dat_ms
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A     -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-
-replace_with_na_if(data = dat_ms,
-                 .predicate = is.character,
-                 condition = ~.x == "N/A")
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 NA      -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-replace_with_na_if(data = dat_ms,
-                   .predicate = is.character,
-                   condition = ~.x %in% common_na_strings)
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 NA      -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-
-replace_with_na(dat_ms,
-              to_na = list(x = c(-99, -98),
-                           y = c("N/A"),
-                           z = c(-101)))
-#> # A tibble: 5 × 3
-#>       x y         z
-#>   <dbl> <chr> <dbl>
-#> 1     1 A      -100
-#> 2     3 N/A     -99
-#> 3    NA NA      -98
-#> 4   -99 E      -101
-#> 5   -98 F        -1
-
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/riskfactors-1.png b/docs/reference/riskfactors-1.png deleted file mode 100644 index f2020c8e..00000000 Binary files a/docs/reference/riskfactors-1.png and /dev/null differ diff --git a/docs/reference/riskfactors-2.png b/docs/reference/riskfactors-2.png deleted file mode 100644 index 96d2732c..00000000 Binary files a/docs/reference/riskfactors-2.png and /dev/null differ diff --git a/docs/reference/riskfactors-3.png b/docs/reference/riskfactors-3.png deleted file mode 100644 index c15db314..00000000 Binary files a/docs/reference/riskfactors-3.png and /dev/null differ diff --git a/docs/reference/riskfactors-4.png b/docs/reference/riskfactors-4.png deleted file mode 100644 index 72cdda8c..00000000 Binary files a/docs/reference/riskfactors-4.png and /dev/null differ diff --git a/docs/reference/riskfactors-5.png b/docs/reference/riskfactors-5.png deleted file mode 100644 index 8e568e26..00000000 Binary files a/docs/reference/riskfactors-5.png and /dev/null differ diff --git a/docs/reference/riskfactors.html b/docs/reference/riskfactors.html deleted file mode 100644 index bc851c0d..00000000 --- a/docs/reference/riskfactors.html +++ /dev/null @@ -1,355 +0,0 @@ - -The Behavioral Risk Factor Surveillance System (BRFSS) Survey -Data, 2009. — riskfactors • naniar - Skip to contents - - -
-
-
- -
-

The data is a subset of the 2009 survey from BRFSS, an ongoing data -collection program designed to measure behavioral risk factors for the -adult population (18 years of age or older) living in households.

-
- -
-

Usage

-
data(riskfactors)
-
- -
-

Format

-

An object of class tbl_df (inherits from tbl, data.frame) with 245 rows and 34 columns.

-
- -
-

See also

-

the codebook: -https://www.cdc.gov/brfss/annual_data/annual_2009.htm

-

Format: a data frame with 245 observations on the following 34 -variables.

-
state
-

A factor with 52 levels. The labels and states -corresponding to the labels are as follows: 1:Alabama, 2:Alaska, 4:Arizona, -5:Arkansas, 6:California,8:Colorado, 9:Connecticut, 10:Delaware, 11:District -of Columbia,12:Florida, 13:Georgia, 15:Hawaii, 16:Idaho, 1 -:Illinois,18:Indiana, 19:Iowa, 20:Kansas, 21:Kentucky, 22:Louisiana,23:Maine, -24:Maryland, 25:Massachusetts, 26:Michigan,27:Minnesota, 28:Mississippi, -2:Missouri, 30:Montana,31:Nebraska, 32:Nevada, 33:New Hampshire, 34:New -Jersey, 35:NewMexico, 36:New York, 37:North Carolina, 38:North Dakota, -39:Ohio,40:Oklahoma, 41:Oregon, 42:Pennsylvania, 44:Rhode Island, -45:SouthCarolina, 46:South Dakota, 47:Tennessee, 48:Texas, 49:Utah, -50:Vermont, 51:Virginia, 53:Washington, 54:West Virginia,55:Wisconsin, -56:Wyoming, 66:Guam, 72:Puerto Rico, 78:Virgin Islands

- -
sex
-

A factor with levels Male Female.

- -
age
-

A numeric vector from 7 to 97.

- -
weight_lbs
-

The weight without shoes in pounds.

- -
height_inch
-

The weight without shoes in inches.

- -
bmi
-

Body Mass Index (BMI). Computed by weight in Kilogram -/(height in Meters * height in Meters). Missing if any of weight or -height is missing.

- -
marital
-

A factor with levels Married Divorced -Widowed Separated NeverMarried UnmarriedCouple.

- -
pregnant
-

Whether pregnant now with two levels Yes and -No.

- -
children
-

A numeric vector giving the number of children less -than 18 years of age in household.

- -
education
-

A factor with the education levels 1 -2 3 4 5 6 as 1: Never attended -school or only kindergarten; 2: Grades 1 through 8 (Elementary); -3: Grades 9 through 11 (Some high school); 4: Grade 12 or GED -(High school graduate); 5: College 1 year to 3 years (Some college -or technical school); 6: College 4 years or more (College -graduate).

- -
employment
-

A factor showing the employment status with levels -1 2 3 4 5 7 8. The labels -mean -- 1: Employed for wages; 2: Self-employed; 3: Out of work for more -than 1 year; 4: Out of work for less that 1 year; 5: A homemaker; 6: A -student; 7:Retired; 8: Unable to work.

- -
income
-

The annual household income from all sources with -levels <10k 10-15k 15-20k 20-25k 25-35k -35-50k 50-75k >75k Dontknow Refused.

- -
veteran
-

A factor with levels 1 2 3 -4 5. The question for this variable is: Have you ever -served on active duty in the United States Armed Forces, either in the -regular military or in a National Guard or military reserve unit? Active -duty does not include training for the Reserves or National Guard, but -DOES include activation, for example, for the Persian Gulf War. And the -labels are meaning: 1: Yes, now on active duty; 2: Yes, on active duty -during the last 12 months, but not now; 3: Yes, on active duty in the -past, but not during the last 12 months; 4: No, training for Reserves or -National Guard only; 5: No, never served in the military.

- -
hispanic
-

A factor with levels Yes No -corresponding to the question: are you Hispanic or Latino?

- -
health_general
-

Answer to question "in general your health is" -with levels Excellent VeryGood Good Fair -Poor Refused.

- -
health_physical
-

The number of days during the last 30 days -that the respondent's physical health was not good. -7 is for "Don't -know/Not sure", and -9 is for "Refused".

- -
health_mental
-

The number of days during the last 30 days -that the respondent's mental health was not good. -7 is for -"Don't know/Not sure", and -9 is for "Refused".

- -
health_poor
-

The number of days during the last 30 days -that poor physical or mental health keep the respondent from doing -usual activities, such as self-care, work, or recreation. -7 is -for "Don't know/Not sure", and -9 is for "Refused".

- -
health_cover
-

Whether having any kind of health care -coverage, including health insurance, prepaid plans such as HMOs, -or government plans such as Medicare. The answer has two levels: -Yes and No.

- -
provide_care
-

Whether providing any such care or assistance -to a friend or family member during the past month, with levels Yes -and No.

- -
activity_limited
-

Whether being limited in any way in any -activities because of physical, mental, or emotional problems, -with levels Yes and No.

- -
drink_any
-

Whether having had at least one drink of -any alcoholic beverage such as beer, wine, a malt beverage or -liquor during the past 30 days, with levels Yes and -No.

- -
drink_days
-

The number of days during the past 30 days that -the respondent had at least one drink of any alcoholic beverage. -7 is -for "Don't know/Not sure", and -9 is for "Refused".

- -
drink_avg
-

The number of drinks on the average the respondent -had on the days when he/she drank, during the past 30 days. -7 is for -"Don't know/Not sure", and -9 is for "Refused".

- -
smoke_100
-

Whether having smoked at least -100 cigarettes in the entire life, with levels Yes and -No.

- -
smoke_days
-

The frequency of days now -smoking, with levels Everyday Somedays and -NotAtAll(not at all).

- -
smoke_stop
-

Whether -having stopped smoking for one day or longer during the past 12 -months because the respondent was trying to quit smoking, with -levels Yes and No.

- -
smoke_last
-

A factor -with levels 3 4 5 6 7 8 -corresponding to the question: how long has it been since last -smoking cigarettes regularly? The labels mean: 3: Within the past -6 months (3 months but less than 6 months ago); 4: Within the past -year (6 months but less than 1 year ago); 5: Within the past 5 -years (1 year but less than 5 years ago); 6: Within the past 10 -years (5 years but less than 10 years ago); 7: 10 years or more; -8: Never smoked regularly.

- -
diet_fruit
-

The number of -fruit the respondent eat every year, not counting juice. -7 is for -"Don't know/Not sure", and -9 is for "Refused".

- -
diet_salad
-

The number of servings of green salad the -respondent eat every year. -7 is for "Don't know/Not sure", -and -9 is for "Refused".

- -
diet_potato
-

The number of -servings of potatoes, not including french fries, fried potatoes, -or potato chips, that the respondent eat every year. -7 is for -"Don't know/Not sure", and -9 is for "Refused".

- -
diet_carrot
-

The number of carrots the respondent eat -every year. -7 is for "Don't know/Not sure", and -9 is for -"Refused".

- -
diet_vegetable
-

The number of servings of -vegetables the respondent eat every year, not counting carrots, -potatoes, or salad. -7 is for "Don't know/Not sure", and -9 is -for "Refused".

- -
diet_juice
-

The number of fruit juices -such as orange, grapefruit, or tomato that the respondent drink -every year. -7 is for "Don't know/Not sure", and -9 is for -"Refused".

- - -

library(MissingDataGUI) (named brfss)

-
- -
-

Examples

-

-vis_miss(riskfactors)
-
-
-# Look at the missingness in the variables
-miss_var_summary(riskfactors)
-#> # A tibble: 34 × 3
-#>    variable      n_miss pct_miss
-#>    <chr>          <int>    <dbl>
-#>  1 pregnant         215    87.8 
-#>  2 smoke_stop       212    86.5 
-#>  3 smoke_last       161    65.7 
-#>  4 drink_average    135    55.1 
-#>  5 drink_days       134    54.7 
-#>  6 smoke_days       128    52.2 
-#>  7 health_poor      113    46.1 
-#>  8 bmi               11     4.49
-#>  9 weight_lbs        10     4.08
-#> 10 diet_fruit         8     3.27
-#> # ℹ 24 more rows
-
-# and now as a plot
-gg_miss_var(riskfactors)
-
-
-if (FALSE) {
-# Look at the missingness in bmi and poor health
-library(ggplot2)
-p <-
-ggplot(riskfactors,
-       aes(x = health_poor,
-           y = bmi)) +
-     geom_miss_point()
-
- p
-
- # for each sex?
- p + facet_wrap(~sex)
- # for each education bracket?
- p + facet_wrap(~education)
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/scoped-impute_mean.html b/docs/reference/scoped-impute_mean.html deleted file mode 100644 index 8b2764b3..00000000 --- a/docs/reference/scoped-impute_mean.html +++ /dev/null @@ -1,464 +0,0 @@ - -Scoped variants of impute_mean — scoped-impute_mean • naniar - Skip to contents - - -
-
-
- -
-

impute_mean imputes the mean for a vector. To get it to work on all -variables, use impute_mean_all. To only impute variables -that satisfy a specific condition, use the scoped variants, -impute_below_at, and impute_below_if. To use _at effectively, -you must know that _at`` affects variables selected with a character vector, or with vars()`.

-
- -
-

Usage

-
impute_mean_all(.tbl)
-
-impute_mean_at(.tbl, .vars)
-
-impute_mean_if(.tbl, .predicate)
-
- -
-

Arguments

-
.tbl
-

a data.frame

- - -
.vars
-

variables to impute

- - -
.predicate
-

variables to impute

- -
-
-

Value

- - -

an dataset with values imputed

-
- -
-

Examples

-
# select variables starting with a particular string.
-impute_mean_all(airquality)
-#>         Ozone  Solar.R Wind Temp Month Day
-#> 1    41.00000 190.0000  7.4   67     5   1
-#> 2    36.00000 118.0000  8.0   72     5   2
-#> 3    12.00000 149.0000 12.6   74     5   3
-#> 4    18.00000 313.0000 11.5   62     5   4
-#> 5    42.12931 185.9315 14.3   56     5   5
-#> 6    28.00000 185.9315 14.9   66     5   6
-#> 7    23.00000 299.0000  8.6   65     5   7
-#> 8    19.00000  99.0000 13.8   59     5   8
-#> 9     8.00000  19.0000 20.1   61     5   9
-#> 10   42.12931 194.0000  8.6   69     5  10
-#> 11    7.00000 185.9315  6.9   74     5  11
-#> 12   16.00000 256.0000  9.7   69     5  12
-#> 13   11.00000 290.0000  9.2   66     5  13
-#> 14   14.00000 274.0000 10.9   68     5  14
-#> 15   18.00000  65.0000 13.2   58     5  15
-#> 16   14.00000 334.0000 11.5   64     5  16
-#> 17   34.00000 307.0000 12.0   66     5  17
-#> 18    6.00000  78.0000 18.4   57     5  18
-#> 19   30.00000 322.0000 11.5   68     5  19
-#> 20   11.00000  44.0000  9.7   62     5  20
-#> 21    1.00000   8.0000  9.7   59     5  21
-#> 22   11.00000 320.0000 16.6   73     5  22
-#> 23    4.00000  25.0000  9.7   61     5  23
-#> 24   32.00000  92.0000 12.0   61     5  24
-#> 25   42.12931  66.0000 16.6   57     5  25
-#> 26   42.12931 266.0000 14.9   58     5  26
-#> 27   42.12931 185.9315  8.0   57     5  27
-#> 28   23.00000  13.0000 12.0   67     5  28
-#> 29   45.00000 252.0000 14.9   81     5  29
-#> 30  115.00000 223.0000  5.7   79     5  30
-#> 31   37.00000 279.0000  7.4   76     5  31
-#> 32   42.12931 286.0000  8.6   78     6   1
-#> 33   42.12931 287.0000  9.7   74     6   2
-#> 34   42.12931 242.0000 16.1   67     6   3
-#> 35   42.12931 186.0000  9.2   84     6   4
-#> 36   42.12931 220.0000  8.6   85     6   5
-#> 37   42.12931 264.0000 14.3   79     6   6
-#> 38   29.00000 127.0000  9.7   82     6   7
-#> 39   42.12931 273.0000  6.9   87     6   8
-#> 40   71.00000 291.0000 13.8   90     6   9
-#> 41   39.00000 323.0000 11.5   87     6  10
-#> 42   42.12931 259.0000 10.9   93     6  11
-#> 43   42.12931 250.0000  9.2   92     6  12
-#> 44   23.00000 148.0000  8.0   82     6  13
-#> 45   42.12931 332.0000 13.8   80     6  14
-#> 46   42.12931 322.0000 11.5   79     6  15
-#> 47   21.00000 191.0000 14.9   77     6  16
-#> 48   37.00000 284.0000 20.7   72     6  17
-#> 49   20.00000  37.0000  9.2   65     6  18
-#> 50   12.00000 120.0000 11.5   73     6  19
-#> 51   13.00000 137.0000 10.3   76     6  20
-#> 52   42.12931 150.0000  6.3   77     6  21
-#> 53   42.12931  59.0000  1.7   76     6  22
-#> 54   42.12931  91.0000  4.6   76     6  23
-#> 55   42.12931 250.0000  6.3   76     6  24
-#> 56   42.12931 135.0000  8.0   75     6  25
-#> 57   42.12931 127.0000  8.0   78     6  26
-#> 58   42.12931  47.0000 10.3   73     6  27
-#> 59   42.12931  98.0000 11.5   80     6  28
-#> 60   42.12931  31.0000 14.9   77     6  29
-#> 61   42.12931 138.0000  8.0   83     6  30
-#> 62  135.00000 269.0000  4.1   84     7   1
-#> 63   49.00000 248.0000  9.2   85     7   2
-#> 64   32.00000 236.0000  9.2   81     7   3
-#> 65   42.12931 101.0000 10.9   84     7   4
-#> 66   64.00000 175.0000  4.6   83     7   5
-#> 67   40.00000 314.0000 10.9   83     7   6
-#> 68   77.00000 276.0000  5.1   88     7   7
-#> 69   97.00000 267.0000  6.3   92     7   8
-#> 70   97.00000 272.0000  5.7   92     7   9
-#> 71   85.00000 175.0000  7.4   89     7  10
-#> 72   42.12931 139.0000  8.6   82     7  11
-#> 73   10.00000 264.0000 14.3   73     7  12
-#> 74   27.00000 175.0000 14.9   81     7  13
-#> 75   42.12931 291.0000 14.9   91     7  14
-#> 76    7.00000  48.0000 14.3   80     7  15
-#> 77   48.00000 260.0000  6.9   81     7  16
-#> 78   35.00000 274.0000 10.3   82     7  17
-#> 79   61.00000 285.0000  6.3   84     7  18
-#> 80   79.00000 187.0000  5.1   87     7  19
-#> 81   63.00000 220.0000 11.5   85     7  20
-#> 82   16.00000   7.0000  6.9   74     7  21
-#> 83   42.12931 258.0000  9.7   81     7  22
-#> 84   42.12931 295.0000 11.5   82     7  23
-#> 85   80.00000 294.0000  8.6   86     7  24
-#> 86  108.00000 223.0000  8.0   85     7  25
-#> 87   20.00000  81.0000  8.6   82     7  26
-#> 88   52.00000  82.0000 12.0   86     7  27
-#> 89   82.00000 213.0000  7.4   88     7  28
-#> 90   50.00000 275.0000  7.4   86     7  29
-#> 91   64.00000 253.0000  7.4   83     7  30
-#> 92   59.00000 254.0000  9.2   81     7  31
-#> 93   39.00000  83.0000  6.9   81     8   1
-#> 94    9.00000  24.0000 13.8   81     8   2
-#> 95   16.00000  77.0000  7.4   82     8   3
-#> 96   78.00000 185.9315  6.9   86     8   4
-#> 97   35.00000 185.9315  7.4   85     8   5
-#> 98   66.00000 185.9315  4.6   87     8   6
-#> 99  122.00000 255.0000  4.0   89     8   7
-#> 100  89.00000 229.0000 10.3   90     8   8
-#> 101 110.00000 207.0000  8.0   90     8   9
-#> 102  42.12931 222.0000  8.6   92     8  10
-#> 103  42.12931 137.0000 11.5   86     8  11
-#> 104  44.00000 192.0000 11.5   86     8  12
-#> 105  28.00000 273.0000 11.5   82     8  13
-#> 106  65.00000 157.0000  9.7   80     8  14
-#> 107  42.12931  64.0000 11.5   79     8  15
-#> 108  22.00000  71.0000 10.3   77     8  16
-#> 109  59.00000  51.0000  6.3   79     8  17
-#> 110  23.00000 115.0000  7.4   76     8  18
-#> 111  31.00000 244.0000 10.9   78     8  19
-#> 112  44.00000 190.0000 10.3   78     8  20
-#> 113  21.00000 259.0000 15.5   77     8  21
-#> 114   9.00000  36.0000 14.3   72     8  22
-#> 115  42.12931 255.0000 12.6   75     8  23
-#> 116  45.00000 212.0000  9.7   79     8  24
-#> 117 168.00000 238.0000  3.4   81     8  25
-#> 118  73.00000 215.0000  8.0   86     8  26
-#> 119  42.12931 153.0000  5.7   88     8  27
-#> 120  76.00000 203.0000  9.7   97     8  28
-#> 121 118.00000 225.0000  2.3   94     8  29
-#> 122  84.00000 237.0000  6.3   96     8  30
-#> 123  85.00000 188.0000  6.3   94     8  31
-#> 124  96.00000 167.0000  6.9   91     9   1
-#> 125  78.00000 197.0000  5.1   92     9   2
-#> 126  73.00000 183.0000  2.8   93     9   3
-#> 127  91.00000 189.0000  4.6   93     9   4
-#> 128  47.00000  95.0000  7.4   87     9   5
-#> 129  32.00000  92.0000 15.5   84     9   6
-#> 130  20.00000 252.0000 10.9   80     9   7
-#> 131  23.00000 220.0000 10.3   78     9   8
-#> 132  21.00000 230.0000 10.9   75     9   9
-#> 133  24.00000 259.0000  9.7   73     9  10
-#> 134  44.00000 236.0000 14.9   81     9  11
-#> 135  21.00000 259.0000 15.5   76     9  12
-#> 136  28.00000 238.0000  6.3   77     9  13
-#> 137   9.00000  24.0000 10.9   71     9  14
-#> 138  13.00000 112.0000 11.5   71     9  15
-#> 139  46.00000 237.0000  6.9   78     9  16
-#> 140  18.00000 224.0000 13.8   67     9  17
-#> 141  13.00000  27.0000 10.3   76     9  18
-#> 142  24.00000 238.0000 10.3   68     9  19
-#> 143  16.00000 201.0000  8.0   82     9  20
-#> 144  13.00000 238.0000 12.6   64     9  21
-#> 145  23.00000  14.0000  9.2   71     9  22
-#> 146  36.00000 139.0000 10.3   81     9  23
-#> 147   7.00000  49.0000 10.3   69     9  24
-#> 148  14.00000  20.0000 16.6   63     9  25
-#> 149  30.00000 193.0000  6.9   70     9  26
-#> 150  42.12931 145.0000 13.2   77     9  27
-#> 151  14.00000 191.0000 14.3   75     9  28
-#> 152  18.00000 131.0000  8.0   76     9  29
-#> 153  20.00000 223.0000 11.5   68     9  30
-
-impute_mean_at(airquality,
-               .vars = c("Ozone", "Solar.R"))
-#>         Ozone  Solar.R Wind Temp Month Day
-#> 1    41.00000 190.0000  7.4   67     5   1
-#> 2    36.00000 118.0000  8.0   72     5   2
-#> 3    12.00000 149.0000 12.6   74     5   3
-#> 4    18.00000 313.0000 11.5   62     5   4
-#> 5    42.12931 185.9315 14.3   56     5   5
-#> 6    28.00000 185.9315 14.9   66     5   6
-#> 7    23.00000 299.0000  8.6   65     5   7
-#> 8    19.00000  99.0000 13.8   59     5   8
-#> 9     8.00000  19.0000 20.1   61     5   9
-#> 10   42.12931 194.0000  8.6   69     5  10
-#> 11    7.00000 185.9315  6.9   74     5  11
-#> 12   16.00000 256.0000  9.7   69     5  12
-#> 13   11.00000 290.0000  9.2   66     5  13
-#> 14   14.00000 274.0000 10.9   68     5  14
-#> 15   18.00000  65.0000 13.2   58     5  15
-#> 16   14.00000 334.0000 11.5   64     5  16
-#> 17   34.00000 307.0000 12.0   66     5  17
-#> 18    6.00000  78.0000 18.4   57     5  18
-#> 19   30.00000 322.0000 11.5   68     5  19
-#> 20   11.00000  44.0000  9.7   62     5  20
-#> 21    1.00000   8.0000  9.7   59     5  21
-#> 22   11.00000 320.0000 16.6   73     5  22
-#> 23    4.00000  25.0000  9.7   61     5  23
-#> 24   32.00000  92.0000 12.0   61     5  24
-#> 25   42.12931  66.0000 16.6   57     5  25
-#> 26   42.12931 266.0000 14.9   58     5  26
-#> 27   42.12931 185.9315  8.0   57     5  27
-#> 28   23.00000  13.0000 12.0   67     5  28
-#> 29   45.00000 252.0000 14.9   81     5  29
-#> 30  115.00000 223.0000  5.7   79     5  30
-#> 31   37.00000 279.0000  7.4   76     5  31
-#> 32   42.12931 286.0000  8.6   78     6   1
-#> 33   42.12931 287.0000  9.7   74     6   2
-#> 34   42.12931 242.0000 16.1   67     6   3
-#> 35   42.12931 186.0000  9.2   84     6   4
-#> 36   42.12931 220.0000  8.6   85     6   5
-#> 37   42.12931 264.0000 14.3   79     6   6
-#> 38   29.00000 127.0000  9.7   82     6   7
-#> 39   42.12931 273.0000  6.9   87     6   8
-#> 40   71.00000 291.0000 13.8   90     6   9
-#> 41   39.00000 323.0000 11.5   87     6  10
-#> 42   42.12931 259.0000 10.9   93     6  11
-#> 43   42.12931 250.0000  9.2   92     6  12
-#> 44   23.00000 148.0000  8.0   82     6  13
-#> 45   42.12931 332.0000 13.8   80     6  14
-#> 46   42.12931 322.0000 11.5   79     6  15
-#> 47   21.00000 191.0000 14.9   77     6  16
-#> 48   37.00000 284.0000 20.7   72     6  17
-#> 49   20.00000  37.0000  9.2   65     6  18
-#> 50   12.00000 120.0000 11.5   73     6  19
-#> 51   13.00000 137.0000 10.3   76     6  20
-#> 52   42.12931 150.0000  6.3   77     6  21
-#> 53   42.12931  59.0000  1.7   76     6  22
-#> 54   42.12931  91.0000  4.6   76     6  23
-#> 55   42.12931 250.0000  6.3   76     6  24
-#> 56   42.12931 135.0000  8.0   75     6  25
-#> 57   42.12931 127.0000  8.0   78     6  26
-#> 58   42.12931  47.0000 10.3   73     6  27
-#> 59   42.12931  98.0000 11.5   80     6  28
-#> 60   42.12931  31.0000 14.9   77     6  29
-#> 61   42.12931 138.0000  8.0   83     6  30
-#> 62  135.00000 269.0000  4.1   84     7   1
-#> 63   49.00000 248.0000  9.2   85     7   2
-#> 64   32.00000 236.0000  9.2   81     7   3
-#> 65   42.12931 101.0000 10.9   84     7   4
-#> 66   64.00000 175.0000  4.6   83     7   5
-#> 67   40.00000 314.0000 10.9   83     7   6
-#> 68   77.00000 276.0000  5.1   88     7   7
-#> 69   97.00000 267.0000  6.3   92     7   8
-#> 70   97.00000 272.0000  5.7   92     7   9
-#> 71   85.00000 175.0000  7.4   89     7  10
-#> 72   42.12931 139.0000  8.6   82     7  11
-#> 73   10.00000 264.0000 14.3   73     7  12
-#> 74   27.00000 175.0000 14.9   81     7  13
-#> 75   42.12931 291.0000 14.9   91     7  14
-#> 76    7.00000  48.0000 14.3   80     7  15
-#> 77   48.00000 260.0000  6.9   81     7  16
-#> 78   35.00000 274.0000 10.3   82     7  17
-#> 79   61.00000 285.0000  6.3   84     7  18
-#> 80   79.00000 187.0000  5.1   87     7  19
-#> 81   63.00000 220.0000 11.5   85     7  20
-#> 82   16.00000   7.0000  6.9   74     7  21
-#> 83   42.12931 258.0000  9.7   81     7  22
-#> 84   42.12931 295.0000 11.5   82     7  23
-#> 85   80.00000 294.0000  8.6   86     7  24
-#> 86  108.00000 223.0000  8.0   85     7  25
-#> 87   20.00000  81.0000  8.6   82     7  26
-#> 88   52.00000  82.0000 12.0   86     7  27
-#> 89   82.00000 213.0000  7.4   88     7  28
-#> 90   50.00000 275.0000  7.4   86     7  29
-#> 91   64.00000 253.0000  7.4   83     7  30
-#> 92   59.00000 254.0000  9.2   81     7  31
-#> 93   39.00000  83.0000  6.9   81     8   1
-#> 94    9.00000  24.0000 13.8   81     8   2
-#> 95   16.00000  77.0000  7.4   82     8   3
-#> 96   78.00000 185.9315  6.9   86     8   4
-#> 97   35.00000 185.9315  7.4   85     8   5
-#> 98   66.00000 185.9315  4.6   87     8   6
-#> 99  122.00000 255.0000  4.0   89     8   7
-#> 100  89.00000 229.0000 10.3   90     8   8
-#> 101 110.00000 207.0000  8.0   90     8   9
-#> 102  42.12931 222.0000  8.6   92     8  10
-#> 103  42.12931 137.0000 11.5   86     8  11
-#> 104  44.00000 192.0000 11.5   86     8  12
-#> 105  28.00000 273.0000 11.5   82     8  13
-#> 106  65.00000 157.0000  9.7   80     8  14
-#> 107  42.12931  64.0000 11.5   79     8  15
-#> 108  22.00000  71.0000 10.3   77     8  16
-#> 109  59.00000  51.0000  6.3   79     8  17
-#> 110  23.00000 115.0000  7.4   76     8  18
-#> 111  31.00000 244.0000 10.9   78     8  19
-#> 112  44.00000 190.0000 10.3   78     8  20
-#> 113  21.00000 259.0000 15.5   77     8  21
-#> 114   9.00000  36.0000 14.3   72     8  22
-#> 115  42.12931 255.0000 12.6   75     8  23
-#> 116  45.00000 212.0000  9.7   79     8  24
-#> 117 168.00000 238.0000  3.4   81     8  25
-#> 118  73.00000 215.0000  8.0   86     8  26
-#> 119  42.12931 153.0000  5.7   88     8  27
-#> 120  76.00000 203.0000  9.7   97     8  28
-#> 121 118.00000 225.0000  2.3   94     8  29
-#> 122  84.00000 237.0000  6.3   96     8  30
-#> 123  85.00000 188.0000  6.3   94     8  31
-#> 124  96.00000 167.0000  6.9   91     9   1
-#> 125  78.00000 197.0000  5.1   92     9   2
-#> 126  73.00000 183.0000  2.8   93     9   3
-#> 127  91.00000 189.0000  4.6   93     9   4
-#> 128  47.00000  95.0000  7.4   87     9   5
-#> 129  32.00000  92.0000 15.5   84     9   6
-#> 130  20.00000 252.0000 10.9   80     9   7
-#> 131  23.00000 220.0000 10.3   78     9   8
-#> 132  21.00000 230.0000 10.9   75     9   9
-#> 133  24.00000 259.0000  9.7   73     9  10
-#> 134  44.00000 236.0000 14.9   81     9  11
-#> 135  21.00000 259.0000 15.5   76     9  12
-#> 136  28.00000 238.0000  6.3   77     9  13
-#> 137   9.00000  24.0000 10.9   71     9  14
-#> 138  13.00000 112.0000 11.5   71     9  15
-#> 139  46.00000 237.0000  6.9   78     9  16
-#> 140  18.00000 224.0000 13.8   67     9  17
-#> 141  13.00000  27.0000 10.3   76     9  18
-#> 142  24.00000 238.0000 10.3   68     9  19
-#> 143  16.00000 201.0000  8.0   82     9  20
-#> 144  13.00000 238.0000 12.6   64     9  21
-#> 145  23.00000  14.0000  9.2   71     9  22
-#> 146  36.00000 139.0000 10.3   81     9  23
-#> 147   7.00000  49.0000 10.3   69     9  24
-#> 148  14.00000  20.0000 16.6   63     9  25
-#> 149  30.00000 193.0000  6.9   70     9  26
-#> 150  42.12931 145.0000 13.2   77     9  27
-#> 151  14.00000 191.0000 14.3   75     9  28
-#> 152  18.00000 131.0000  8.0   76     9  29
-#> 153  20.00000 223.0000 11.5   68     9  30
-
-if (FALSE) {
-library(dplyr)
-impute_mean_at(airquality,
-                .vars = vars(Ozone))
-
-impute_mean_if(airquality,
-                .predicate = is.numeric)
-
-library(ggplot2)
-airquality %>%
-  bind_shadow() %>%
-  impute_mean_all() %>%
-  add_label_shadow() %>%
-  ggplot(aes(x = Ozone,
-             y = Solar.R,
-             colour = any_missing)) +
-         geom_point()
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/scoped-impute_median.html b/docs/reference/scoped-impute_median.html deleted file mode 100644 index ee8142ba..00000000 --- a/docs/reference/scoped-impute_median.html +++ /dev/null @@ -1,463 +0,0 @@ - -Scoped variants of impute_median — scoped-impute_median • naniar - Skip to contents - - -
-
-
- -
-

impute_median imputes the median for a vector. To get it to work on all -variables, use impute_median_all. To only impute variables -that satisfy a specific condition, use the scoped variants, -impute_below_at, and impute_below_if. To use _at effectively, -you must know that _at`` affects variables selected with a character vector, or with vars()`.

-
- -
-

Usage

-
impute_median_all(.tbl)
-
-impute_median_at(.tbl, .vars)
-
-impute_median_if(.tbl, .predicate)
-
- -
-

Arguments

-
.tbl
-

a data.frame

- - -
.vars
-

variables to impute

- - -
.predicate
-

variables to impute

- -
-
-

Value

- - -

an dataset with values imputed

-
- -
-

Examples

-
# select variables starting with a particular string.
-impute_median_all(airquality)
-#>     Ozone Solar.R Wind Temp Month Day
-#> 1    41.0     190  7.4   67     5   1
-#> 2    36.0     118  8.0   72     5   2
-#> 3    12.0     149 12.6   74     5   3
-#> 4    18.0     313 11.5   62     5   4
-#> 5    31.5     205 14.3   56     5   5
-#> 6    28.0     205 14.9   66     5   6
-#> 7    23.0     299  8.6   65     5   7
-#> 8    19.0      99 13.8   59     5   8
-#> 9     8.0      19 20.1   61     5   9
-#> 10   31.5     194  8.6   69     5  10
-#> 11    7.0     205  6.9   74     5  11
-#> 12   16.0     256  9.7   69     5  12
-#> 13   11.0     290  9.2   66     5  13
-#> 14   14.0     274 10.9   68     5  14
-#> 15   18.0      65 13.2   58     5  15
-#> 16   14.0     334 11.5   64     5  16
-#> 17   34.0     307 12.0   66     5  17
-#> 18    6.0      78 18.4   57     5  18
-#> 19   30.0     322 11.5   68     5  19
-#> 20   11.0      44  9.7   62     5  20
-#> 21    1.0       8  9.7   59     5  21
-#> 22   11.0     320 16.6   73     5  22
-#> 23    4.0      25  9.7   61     5  23
-#> 24   32.0      92 12.0   61     5  24
-#> 25   31.5      66 16.6   57     5  25
-#> 26   31.5     266 14.9   58     5  26
-#> 27   31.5     205  8.0   57     5  27
-#> 28   23.0      13 12.0   67     5  28
-#> 29   45.0     252 14.9   81     5  29
-#> 30  115.0     223  5.7   79     5  30
-#> 31   37.0     279  7.4   76     5  31
-#> 32   31.5     286  8.6   78     6   1
-#> 33   31.5     287  9.7   74     6   2
-#> 34   31.5     242 16.1   67     6   3
-#> 35   31.5     186  9.2   84     6   4
-#> 36   31.5     220  8.6   85     6   5
-#> 37   31.5     264 14.3   79     6   6
-#> 38   29.0     127  9.7   82     6   7
-#> 39   31.5     273  6.9   87     6   8
-#> 40   71.0     291 13.8   90     6   9
-#> 41   39.0     323 11.5   87     6  10
-#> 42   31.5     259 10.9   93     6  11
-#> 43   31.5     250  9.2   92     6  12
-#> 44   23.0     148  8.0   82     6  13
-#> 45   31.5     332 13.8   80     6  14
-#> 46   31.5     322 11.5   79     6  15
-#> 47   21.0     191 14.9   77     6  16
-#> 48   37.0     284 20.7   72     6  17
-#> 49   20.0      37  9.2   65     6  18
-#> 50   12.0     120 11.5   73     6  19
-#> 51   13.0     137 10.3   76     6  20
-#> 52   31.5     150  6.3   77     6  21
-#> 53   31.5      59  1.7   76     6  22
-#> 54   31.5      91  4.6   76     6  23
-#> 55   31.5     250  6.3   76     6  24
-#> 56   31.5     135  8.0   75     6  25
-#> 57   31.5     127  8.0   78     6  26
-#> 58   31.5      47 10.3   73     6  27
-#> 59   31.5      98 11.5   80     6  28
-#> 60   31.5      31 14.9   77     6  29
-#> 61   31.5     138  8.0   83     6  30
-#> 62  135.0     269  4.1   84     7   1
-#> 63   49.0     248  9.2   85     7   2
-#> 64   32.0     236  9.2   81     7   3
-#> 65   31.5     101 10.9   84     7   4
-#> 66   64.0     175  4.6   83     7   5
-#> 67   40.0     314 10.9   83     7   6
-#> 68   77.0     276  5.1   88     7   7
-#> 69   97.0     267  6.3   92     7   8
-#> 70   97.0     272  5.7   92     7   9
-#> 71   85.0     175  7.4   89     7  10
-#> 72   31.5     139  8.6   82     7  11
-#> 73   10.0     264 14.3   73     7  12
-#> 74   27.0     175 14.9   81     7  13
-#> 75   31.5     291 14.9   91     7  14
-#> 76    7.0      48 14.3   80     7  15
-#> 77   48.0     260  6.9   81     7  16
-#> 78   35.0     274 10.3   82     7  17
-#> 79   61.0     285  6.3   84     7  18
-#> 80   79.0     187  5.1   87     7  19
-#> 81   63.0     220 11.5   85     7  20
-#> 82   16.0       7  6.9   74     7  21
-#> 83   31.5     258  9.7   81     7  22
-#> 84   31.5     295 11.5   82     7  23
-#> 85   80.0     294  8.6   86     7  24
-#> 86  108.0     223  8.0   85     7  25
-#> 87   20.0      81  8.6   82     7  26
-#> 88   52.0      82 12.0   86     7  27
-#> 89   82.0     213  7.4   88     7  28
-#> 90   50.0     275  7.4   86     7  29
-#> 91   64.0     253  7.4   83     7  30
-#> 92   59.0     254  9.2   81     7  31
-#> 93   39.0      83  6.9   81     8   1
-#> 94    9.0      24 13.8   81     8   2
-#> 95   16.0      77  7.4   82     8   3
-#> 96   78.0     205  6.9   86     8   4
-#> 97   35.0     205  7.4   85     8   5
-#> 98   66.0     205  4.6   87     8   6
-#> 99  122.0     255  4.0   89     8   7
-#> 100  89.0     229 10.3   90     8   8
-#> 101 110.0     207  8.0   90     8   9
-#> 102  31.5     222  8.6   92     8  10
-#> 103  31.5     137 11.5   86     8  11
-#> 104  44.0     192 11.5   86     8  12
-#> 105  28.0     273 11.5   82     8  13
-#> 106  65.0     157  9.7   80     8  14
-#> 107  31.5      64 11.5   79     8  15
-#> 108  22.0      71 10.3   77     8  16
-#> 109  59.0      51  6.3   79     8  17
-#> 110  23.0     115  7.4   76     8  18
-#> 111  31.0     244 10.9   78     8  19
-#> 112  44.0     190 10.3   78     8  20
-#> 113  21.0     259 15.5   77     8  21
-#> 114   9.0      36 14.3   72     8  22
-#> 115  31.5     255 12.6   75     8  23
-#> 116  45.0     212  9.7   79     8  24
-#> 117 168.0     238  3.4   81     8  25
-#> 118  73.0     215  8.0   86     8  26
-#> 119  31.5     153  5.7   88     8  27
-#> 120  76.0     203  9.7   97     8  28
-#> 121 118.0     225  2.3   94     8  29
-#> 122  84.0     237  6.3   96     8  30
-#> 123  85.0     188  6.3   94     8  31
-#> 124  96.0     167  6.9   91     9   1
-#> 125  78.0     197  5.1   92     9   2
-#> 126  73.0     183  2.8   93     9   3
-#> 127  91.0     189  4.6   93     9   4
-#> 128  47.0      95  7.4   87     9   5
-#> 129  32.0      92 15.5   84     9   6
-#> 130  20.0     252 10.9   80     9   7
-#> 131  23.0     220 10.3   78     9   8
-#> 132  21.0     230 10.9   75     9   9
-#> 133  24.0     259  9.7   73     9  10
-#> 134  44.0     236 14.9   81     9  11
-#> 135  21.0     259 15.5   76     9  12
-#> 136  28.0     238  6.3   77     9  13
-#> 137   9.0      24 10.9   71     9  14
-#> 138  13.0     112 11.5   71     9  15
-#> 139  46.0     237  6.9   78     9  16
-#> 140  18.0     224 13.8   67     9  17
-#> 141  13.0      27 10.3   76     9  18
-#> 142  24.0     238 10.3   68     9  19
-#> 143  16.0     201  8.0   82     9  20
-#> 144  13.0     238 12.6   64     9  21
-#> 145  23.0      14  9.2   71     9  22
-#> 146  36.0     139 10.3   81     9  23
-#> 147   7.0      49 10.3   69     9  24
-#> 148  14.0      20 16.6   63     9  25
-#> 149  30.0     193  6.9   70     9  26
-#> 150  31.5     145 13.2   77     9  27
-#> 151  14.0     191 14.3   75     9  28
-#> 152  18.0     131  8.0   76     9  29
-#> 153  20.0     223 11.5   68     9  30
-
-impute_median_at(airquality,
-               .vars = c("Ozone", "Solar.R"))
-#>     Ozone Solar.R Wind Temp Month Day
-#> 1    41.0     190  7.4   67     5   1
-#> 2    36.0     118  8.0   72     5   2
-#> 3    12.0     149 12.6   74     5   3
-#> 4    18.0     313 11.5   62     5   4
-#> 5    31.5     205 14.3   56     5   5
-#> 6    28.0     205 14.9   66     5   6
-#> 7    23.0     299  8.6   65     5   7
-#> 8    19.0      99 13.8   59     5   8
-#> 9     8.0      19 20.1   61     5   9
-#> 10   31.5     194  8.6   69     5  10
-#> 11    7.0     205  6.9   74     5  11
-#> 12   16.0     256  9.7   69     5  12
-#> 13   11.0     290  9.2   66     5  13
-#> 14   14.0     274 10.9   68     5  14
-#> 15   18.0      65 13.2   58     5  15
-#> 16   14.0     334 11.5   64     5  16
-#> 17   34.0     307 12.0   66     5  17
-#> 18    6.0      78 18.4   57     5  18
-#> 19   30.0     322 11.5   68     5  19
-#> 20   11.0      44  9.7   62     5  20
-#> 21    1.0       8  9.7   59     5  21
-#> 22   11.0     320 16.6   73     5  22
-#> 23    4.0      25  9.7   61     5  23
-#> 24   32.0      92 12.0   61     5  24
-#> 25   31.5      66 16.6   57     5  25
-#> 26   31.5     266 14.9   58     5  26
-#> 27   31.5     205  8.0   57     5  27
-#> 28   23.0      13 12.0   67     5  28
-#> 29   45.0     252 14.9   81     5  29
-#> 30  115.0     223  5.7   79     5  30
-#> 31   37.0     279  7.4   76     5  31
-#> 32   31.5     286  8.6   78     6   1
-#> 33   31.5     287  9.7   74     6   2
-#> 34   31.5     242 16.1   67     6   3
-#> 35   31.5     186  9.2   84     6   4
-#> 36   31.5     220  8.6   85     6   5
-#> 37   31.5     264 14.3   79     6   6
-#> 38   29.0     127  9.7   82     6   7
-#> 39   31.5     273  6.9   87     6   8
-#> 40   71.0     291 13.8   90     6   9
-#> 41   39.0     323 11.5   87     6  10
-#> 42   31.5     259 10.9   93     6  11
-#> 43   31.5     250  9.2   92     6  12
-#> 44   23.0     148  8.0   82     6  13
-#> 45   31.5     332 13.8   80     6  14
-#> 46   31.5     322 11.5   79     6  15
-#> 47   21.0     191 14.9   77     6  16
-#> 48   37.0     284 20.7   72     6  17
-#> 49   20.0      37  9.2   65     6  18
-#> 50   12.0     120 11.5   73     6  19
-#> 51   13.0     137 10.3   76     6  20
-#> 52   31.5     150  6.3   77     6  21
-#> 53   31.5      59  1.7   76     6  22
-#> 54   31.5      91  4.6   76     6  23
-#> 55   31.5     250  6.3   76     6  24
-#> 56   31.5     135  8.0   75     6  25
-#> 57   31.5     127  8.0   78     6  26
-#> 58   31.5      47 10.3   73     6  27
-#> 59   31.5      98 11.5   80     6  28
-#> 60   31.5      31 14.9   77     6  29
-#> 61   31.5     138  8.0   83     6  30
-#> 62  135.0     269  4.1   84     7   1
-#> 63   49.0     248  9.2   85     7   2
-#> 64   32.0     236  9.2   81     7   3
-#> 65   31.5     101 10.9   84     7   4
-#> 66   64.0     175  4.6   83     7   5
-#> 67   40.0     314 10.9   83     7   6
-#> 68   77.0     276  5.1   88     7   7
-#> 69   97.0     267  6.3   92     7   8
-#> 70   97.0     272  5.7   92     7   9
-#> 71   85.0     175  7.4   89     7  10
-#> 72   31.5     139  8.6   82     7  11
-#> 73   10.0     264 14.3   73     7  12
-#> 74   27.0     175 14.9   81     7  13
-#> 75   31.5     291 14.9   91     7  14
-#> 76    7.0      48 14.3   80     7  15
-#> 77   48.0     260  6.9   81     7  16
-#> 78   35.0     274 10.3   82     7  17
-#> 79   61.0     285  6.3   84     7  18
-#> 80   79.0     187  5.1   87     7  19
-#> 81   63.0     220 11.5   85     7  20
-#> 82   16.0       7  6.9   74     7  21
-#> 83   31.5     258  9.7   81     7  22
-#> 84   31.5     295 11.5   82     7  23
-#> 85   80.0     294  8.6   86     7  24
-#> 86  108.0     223  8.0   85     7  25
-#> 87   20.0      81  8.6   82     7  26
-#> 88   52.0      82 12.0   86     7  27
-#> 89   82.0     213  7.4   88     7  28
-#> 90   50.0     275  7.4   86     7  29
-#> 91   64.0     253  7.4   83     7  30
-#> 92   59.0     254  9.2   81     7  31
-#> 93   39.0      83  6.9   81     8   1
-#> 94    9.0      24 13.8   81     8   2
-#> 95   16.0      77  7.4   82     8   3
-#> 96   78.0     205  6.9   86     8   4
-#> 97   35.0     205  7.4   85     8   5
-#> 98   66.0     205  4.6   87     8   6
-#> 99  122.0     255  4.0   89     8   7
-#> 100  89.0     229 10.3   90     8   8
-#> 101 110.0     207  8.0   90     8   9
-#> 102  31.5     222  8.6   92     8  10
-#> 103  31.5     137 11.5   86     8  11
-#> 104  44.0     192 11.5   86     8  12
-#> 105  28.0     273 11.5   82     8  13
-#> 106  65.0     157  9.7   80     8  14
-#> 107  31.5      64 11.5   79     8  15
-#> 108  22.0      71 10.3   77     8  16
-#> 109  59.0      51  6.3   79     8  17
-#> 110  23.0     115  7.4   76     8  18
-#> 111  31.0     244 10.9   78     8  19
-#> 112  44.0     190 10.3   78     8  20
-#> 113  21.0     259 15.5   77     8  21
-#> 114   9.0      36 14.3   72     8  22
-#> 115  31.5     255 12.6   75     8  23
-#> 116  45.0     212  9.7   79     8  24
-#> 117 168.0     238  3.4   81     8  25
-#> 118  73.0     215  8.0   86     8  26
-#> 119  31.5     153  5.7   88     8  27
-#> 120  76.0     203  9.7   97     8  28
-#> 121 118.0     225  2.3   94     8  29
-#> 122  84.0     237  6.3   96     8  30
-#> 123  85.0     188  6.3   94     8  31
-#> 124  96.0     167  6.9   91     9   1
-#> 125  78.0     197  5.1   92     9   2
-#> 126  73.0     183  2.8   93     9   3
-#> 127  91.0     189  4.6   93     9   4
-#> 128  47.0      95  7.4   87     9   5
-#> 129  32.0      92 15.5   84     9   6
-#> 130  20.0     252 10.9   80     9   7
-#> 131  23.0     220 10.3   78     9   8
-#> 132  21.0     230 10.9   75     9   9
-#> 133  24.0     259  9.7   73     9  10
-#> 134  44.0     236 14.9   81     9  11
-#> 135  21.0     259 15.5   76     9  12
-#> 136  28.0     238  6.3   77     9  13
-#> 137   9.0      24 10.9   71     9  14
-#> 138  13.0     112 11.5   71     9  15
-#> 139  46.0     237  6.9   78     9  16
-#> 140  18.0     224 13.8   67     9  17
-#> 141  13.0      27 10.3   76     9  18
-#> 142  24.0     238 10.3   68     9  19
-#> 143  16.0     201  8.0   82     9  20
-#> 144  13.0     238 12.6   64     9  21
-#> 145  23.0      14  9.2   71     9  22
-#> 146  36.0     139 10.3   81     9  23
-#> 147   7.0      49 10.3   69     9  24
-#> 148  14.0      20 16.6   63     9  25
-#> 149  30.0     193  6.9   70     9  26
-#> 150  31.5     145 13.2   77     9  27
-#> 151  14.0     191 14.3   75     9  28
-#> 152  18.0     131  8.0   76     9  29
-#> 153  20.0     223 11.5   68     9  30
-if (FALSE) {
-library(dplyr)
-impute_median_at(airquality,
-                .vars = vars(Ozone))
-
-impute_median_if(airquality,
-                .predicate = is.numeric)
-
-library(ggplot2)
-airquality %>%
-  bind_shadow() %>%
-  impute_median_all() %>%
-  add_label_shadow() %>%
-  ggplot(aes(x = Ozone,
-             y = Solar.R,
-             colour = any_missing)) +
-         geom_point()
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/shade.html b/docs/reference/shade.html deleted file mode 100644 index d735c595..00000000 --- a/docs/reference/shade.html +++ /dev/null @@ -1,133 +0,0 @@ - -Create new levels of missing — shade • naniar - Skip to contents - - -
-
-
- -
-

Returns (at least) factors of !NA and NA, where !NA indicates a datum that is -not missing, and NA indicates missingness. It also allows you to specify -some new missings, if you like. This function is what powers the factor -levels in as_shadow().

-
- -
-

Usage

-
shade(x, ..., extra_levels = NULL)
-
- -
-

Arguments

-
x
-

a vector

- - -
...
-

additional levels of missing to add

- - -
extra_levels
-

extra levels you might to specify for the factor.

- -
- -
-

Examples

-
df <- tibble::tribble(
-  ~wind, ~temp,
-  -99,    45,
-  68,    NA,
-  72,    25
-  )
-
-shade(df$wind)
-#> [1] !NA !NA !NA
-#> Levels: !NA NA
-
-shade(df$wind, inst_fail = -99)
-#> [1] NA_inst_fail !NA          !NA         
-#> Levels: !NA NA NA_inst_fail
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/shadow_expand_relevel.html b/docs/reference/shadow_expand_relevel.html deleted file mode 100644 index cd0c560b..00000000 --- a/docs/reference/shadow_expand_relevel.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - - -Expand and relevel a shadow column with a new suffix — shadow_expand_relevel • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Internal function to handle appropriate expansion and releveling of -shadow variables.

-
- -
shadow_expand_relevel(.var, suffix)
- -

Arguments

- - - - - - - - - - -
.var

a variable in a data.frame

suffix

a character suffix to add to NA_, e.

- -

Value

- -

a factor with expanded levels

- -

Examples

-
if (FALSE) { -df <- tibble::tribble( - ~wind, ~temp, - -99, 45, - 68, NA, - 72, 25 -) - -dfs <- bind_shadow(df) - -test_shade <- dfs$wind_NA - -shadow_expand_relevel(test_shade, "weee") - -dfs %>% - mutate(temp_NA = shadow_expand_relevel(temp_NA, "weee")) - - -# test that this breaks -shadow_expand_relevel(airquality, "weee") -}
-
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/shadow_long.html b/docs/reference/shadow_long.html deleted file mode 100644 index 5b2033e8..00000000 --- a/docs/reference/shadow_long.html +++ /dev/null @@ -1,171 +0,0 @@ - -Reshape shadow data into a long format — shadow_long • naniar - Skip to contents - - -
-
-
- -
-

Once data is in nabular form, where the shadow is bound to the data, it -can be useful to reshape it into a long format with the columns

-
- -
-

Usage

-
shadow_long(shadow_data, ..., only_main_vars = TRUE)
-
- -
-

Arguments

-
shadow_data
-

a data.frame

- - -
...
-

bare name of variables that you want to focus on

- - -
only_main_vars
-

logical - do you want to filter down to main variables?

- -
-
-

Value

- - -

data in long format, with columns variable, value, variable_NA, and value_NA.

-
- -
-

Examples

-

-aq_shadow <- bind_shadow(airquality)
-
-shadow_long(aq_shadow)
-#> # A tibble: 918 × 4
-#>    variable value variable_NA value_NA
-#>    <chr>    <dbl> <chr>       <fct>   
-#>  1 Ozone     41   Ozone_NA    !NA     
-#>  2 Solar.R  190   Solar.R_NA  !NA     
-#>  3 Wind       7.4 Wind_NA     !NA     
-#>  4 Temp      67   Temp_NA     !NA     
-#>  5 Month      5   Month_NA    !NA     
-#>  6 Day        1   Day_NA      !NA     
-#>  7 Ozone     36   Ozone_NA    !NA     
-#>  8 Solar.R  118   Solar.R_NA  !NA     
-#>  9 Wind       8   Wind_NA     !NA     
-#> 10 Temp      72   Temp_NA     !NA     
-#> # ℹ 908 more rows
-
-# then filter only on Ozone
-shadow_long(aq_shadow, Ozone)
-#> # A tibble: 153 × 4
-#>    variable value variable_NA value_NA
-#>    <chr>    <dbl> <chr>       <fct>   
-#>  1 Ozone       41 Ozone_NA    !NA     
-#>  2 Ozone       36 Ozone_NA    !NA     
-#>  3 Ozone       12 Ozone_NA    !NA     
-#>  4 Ozone       18 Ozone_NA    !NA     
-#>  5 Ozone       NA Ozone_NA    NA      
-#>  6 Ozone       28 Ozone_NA    !NA     
-#>  7 Ozone       23 Ozone_NA    !NA     
-#>  8 Ozone       19 Ozone_NA    !NA     
-#>  9 Ozone        8 Ozone_NA    !NA     
-#> 10 Ozone       NA Ozone_NA    NA      
-#> # ℹ 143 more rows
-
-shadow_long(aq_shadow, Ozone, Solar.R)
-#> # A tibble: 306 × 4
-#>    variable value variable_NA value_NA
-#>    <chr>    <dbl> <chr>       <fct>   
-#>  1 Ozone       41 Ozone_NA    !NA     
-#>  2 Solar.R    190 Solar.R_NA  !NA     
-#>  3 Ozone       36 Ozone_NA    !NA     
-#>  4 Solar.R    118 Solar.R_NA  !NA     
-#>  5 Ozone       12 Ozone_NA    !NA     
-#>  6 Solar.R    149 Solar.R_NA  !NA     
-#>  7 Ozone       18 Ozone_NA    !NA     
-#>  8 Solar.R    313 Solar.R_NA  !NA     
-#>  9 Ozone       NA Ozone_NA    NA      
-#> 10 Solar.R     NA Solar.R_NA  NA      
-#> # ℹ 296 more rows
-
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/shadow_shift.html b/docs/reference/shadow_shift.html deleted file mode 100644 index f37f7f66..00000000 --- a/docs/reference/shadow_shift.html +++ /dev/null @@ -1,159 +0,0 @@ - -Shift missing values to facilitate missing data exploration/visualisation — shadow_shift • naniar - Skip to contents - - -
-
-
- -
-

shadow_shift transforms missing values to facilitate visualisation, and has -different behaviour for different types of variables. For numeric -variables, the values are shifted to 10% below the minimum value for a given -variable plus some jittered noise, to separate repeated values, so that -missing values can be visualised along with the rest of the data.

-
- -
-

Usage

-
shadow_shift(x, ...)
-
- -
-

Arguments

-
x
-

a variable of interest to shift

- - -
...
-

extra arguments to pass

- -
- - -
-

Examples

-
airquality$Ozone
-#>   [1]  41  36  12  18  NA  28  23  19   8  NA   7  16  11  14  18  14  34   6
-#>  [19]  30  11   1  11   4  32  NA  NA  NA  23  45 115  37  NA  NA  NA  NA  NA
-#>  [37]  NA  29  NA  71  39  NA  NA  23  NA  NA  21  37  20  12  13  NA  NA  NA
-#>  [55]  NA  NA  NA  NA  NA  NA  NA 135  49  32  NA  64  40  77  97  97  85  NA
-#>  [73]  10  27  NA   7  48  35  61  79  63  16  NA  NA  80 108  20  52  82  50
-#>  [91]  64  59  39   9  16  78  35  66 122  89 110  NA  NA  44  28  65  NA  22
-#> [109]  59  23  31  44  21   9  NA  45 168  73  NA  76 118  84  85  96  78  73
-#> [127]  91  47  32  20  23  21  24  44  21  28   9  13  46  18  13  24  16  13
-#> [145]  23  36   7  14  30  NA  14  18  20
-shadow_shift(airquality$Ozone)
-#>   [1]  41.00000  36.00000  12.00000  18.00000 -19.72321  28.00000  23.00000
-#>   [8]  19.00000   8.00000 -18.51277   7.00000  16.00000  11.00000  14.00000
-#>  [15]  18.00000  14.00000  34.00000   6.00000  30.00000  11.00000   1.00000
-#>  [22]  11.00000   4.00000  32.00000 -17.81863 -19.43853 -15.14310  23.00000
-#>  [29]  45.00000 115.00000  37.00000 -16.17315 -14.65883 -17.85609 -13.29299
-#>  [36] -16.16323 -19.60935  29.00000 -19.65780  71.00000  39.00000 -13.40961
-#>  [43] -13.53728  23.00000 -19.65993 -16.48342  21.00000  37.00000  20.00000
-#>  [50]  12.00000  13.00000 -17.17718 -16.74073 -13.65786 -16.78786 -12.30098
-#>  [57] -13.33171 -16.77414 -17.08225 -15.98818 -19.17558 135.00000  49.00000
-#>  [64]  32.00000 -14.27138  64.00000  40.00000  77.00000  97.00000  97.00000
-#>  [71]  85.00000 -13.51764  10.00000  27.00000 -13.48998   7.00000  48.00000
-#>  [78]  35.00000  61.00000  79.00000  63.00000  16.00000 -16.92150 -16.60335
-#>  [85]  80.00000 108.00000  20.00000  52.00000  82.00000  50.00000  64.00000
-#>  [92]  59.00000  39.00000   9.00000  16.00000  78.00000  35.00000  66.00000
-#>  [99] 122.00000  89.00000 110.00000 -14.78907 -16.19151  44.00000  28.00000
-#> [106]  65.00000 -19.73591  22.00000  59.00000  23.00000  31.00000  44.00000
-#> [113]  21.00000   9.00000 -18.92235  45.00000 168.00000  73.00000 -14.86296
-#> [120]  76.00000 118.00000  84.00000  85.00000  96.00000  78.00000  73.00000
-#> [127]  91.00000  47.00000  32.00000  20.00000  23.00000  21.00000  24.00000
-#> [134]  44.00000  21.00000  28.00000   9.00000  13.00000  46.00000  18.00000
-#> [141]  13.00000  24.00000  16.00000  13.00000  23.00000  36.00000   7.00000
-#> [148]  14.00000  30.00000 -14.83089  14.00000  18.00000  20.00000
-if (FALSE) {
-library(dplyr)
-airquality %>%
-    mutate(Ozone_shift = shadow_shift(Ozone))
-}
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/shadow_shift.numeric.html b/docs/reference/shadow_shift.numeric.html deleted file mode 100644 index b03857aa..00000000 --- a/docs/reference/shadow_shift.numeric.html +++ /dev/null @@ -1,120 +0,0 @@ - -Shift (impute) numeric values for graphical exploration — shadow_shift.numeric • naniar - Skip to contents - - -
-
-
- -
-

Shift (impute) numeric values for graphical exploration

-
- -
-

Usage

-
# S3 method for numeric
-shadow_shift(
-  x,
-  prop_below = 0.1,
-  jitter = 0.05,
-  seed_shift = 2017 - 7 - 1 - 1850,
-  ...
-)
-
- -
-

Arguments

-
x
-

a variable of interest to shift

- - -
prop_below
-

the degree to shift the values. default is

- - -
jitter
-

the amount of jitter to add. default is 0.05

- - -
seed_shift
-

a random seed to set, if you like

- - -
...
-

extra arguments to pass

- -
- -
- - -
- - - - - - - diff --git a/docs/reference/stat_miss_point.html b/docs/reference/stat_miss_point.html deleted file mode 100644 index d249d851..00000000 --- a/docs/reference/stat_miss_point.html +++ /dev/null @@ -1,166 +0,0 @@ - -stat_miss_point — stat_miss_point • naniar - Skip to contents - - -
-
-
- -
-

stat_miss_point adds a geometry for displaying missingness to -geom_point

-
- -
-

Usage

-
stat_miss_point(
-  mapping = NULL,
-  data = NULL,
-  prop_below = 0.1,
-  jitter = 0.05,
-  geom = "point",
-  position = "identity",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE,
-  ...
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by ggplot2::aes() -or ggplot2::aes_(). If specified and inherit.aes = TRUE -(the default), is combined with the default mapping at the top level of the -plot. You only need to supply mapping if there isn't a mapping defined for -the plot.

- - -
data
-

A data frame. If specified, overrides the default data frame -defined at the top level of the plot.

- - -
prop_below
-

the degree to shift the values. The default is 0.1

- - -
jitter
-

the amount of jitter to add. The default is 0.05

- - -
geom,
-

stat Override the default connection between geom_point and -stat_point.

- - -
position
-

Position adjustment, either as a string, or the result of a -call to a position adjustment function

- - -
na.rm
-

If FALSE (the default), removes missing values with a warning. -If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. FALSE -never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, rather -than combining with them. This is most useful for helper functions that -define both data and aesthetics and shouldn't inherit behaviour from the -default plot specification, e.g. borders.

- - -
...
-

other arguments passed on to ggplot2::layer(). There -are three types of arguments you can use here:

  • Aesthetics: to set an aesthetic to a fixed value, like -color = "red" or size = 3.

  • -
  • Other arguments to the layer, for example you override the default -stat associated with the layer.

  • -
  • Other arguments passed on to the stat.

  • -
- -
- -
- - -
- - - - - - - diff --git a/docs/reference/stat_missing_point.html b/docs/reference/stat_missing_point.html deleted file mode 100644 index 833deb88..00000000 --- a/docs/reference/stat_missing_point.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - -stat_missing_point — stat_missing_point • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

stat_missing_point adds a geometry for displaying missingness to geom_point

- - -
stat_missing_point(mapping = NULL, data = NULL, geom = "point",
-  position = "identity", na.rm = FALSE, show.legend = NA,
-  inherit.aes = TRUE, ...)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mapping

Set of aesthetic mappings created by aes -or aes_. If specified and inherit.aes = TRUE -(the default), is combined with the default mapping at the top level of the -plot. You only need to supply mapping if there isn't a mapping defined for -the plot.

data

A data frame. If specified, overrides the default data frame -defined at the top level of the plot.

geom,

stat Override the default connection between geom_point and stat_point.

position

Position adjustment, either as a string, or the result of a -call to a position adjustment function

na.rm

If FALSE (the default), removes missing values with a -warning. If TRUE silently removes missing values.

show.legend

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. FALSE -never includes, and TRUE always includes.

inherit.aes

If FALSE, overrides the default aesthetics, rather -than combining with them. This is most useful for helper functions that -define both data and aesthetics and shouldn't inherit behaviour from the -default plot specification, e.g. borders.

...

other arguments passed on to layer. There -are three types of arguments you can use here:

    -
  • Aesthetics: to set an aesthetic to a fixed value, like - color = "red" or size = 3.

  • -
  • Other arguments to the layer, for example you override the default - stat associated with the layer.

  • -
  • Other arguments passed on to the stat.

  • -
- -

Note

- -

Very first attempt at creating a geom that is compatible with ggplot2. -Data plotting works. Still todo: -Warning message if na.rm = T is supplied.

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/summarise_missingness.html b/docs/reference/summarise_missingness.html deleted file mode 100644 index 47bdf889..00000000 --- a/docs/reference/summarise_missingness.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - -Collate summary measures from narnia into one tibble — summarise_missingness • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Deprecated as of version 0.0.6.9000. Please use miss_summary instead.

- - -
summarise_missingness(...)
- -

Arguments

- - - - - - -
...

so that users can still receive meaningful error

- -

See also

- -

miss_summary

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/summary_missing_case.html b/docs/reference/summary_missing_case.html deleted file mode 100644 index 0efa86b5..00000000 --- a/docs/reference/summary_missing_case.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - -Summarise the missingness in each case — summary_missing_case • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Deprecated as of version 0.0.6.9000. Please use miss_case_summary instead.

- - -
summary_missing_case(...)
- -

Arguments

- - - - - - -
...

so that users can still receive meaningful error

- -

See also

- -

miss_case_summary

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/summary_missing_var.html b/docs/reference/summary_missing_var.html deleted file mode 100644 index a7bfd801..00000000 --- a/docs/reference/summary_missing_var.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - -Summarise the missingness in each variable — summary_missing_var • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Deprecated as of version 0.0.6.9000. Please use miss_var_summary instead.

- - -
summary_missing_var(...)
- -

Arguments

- - - - - - -
...

so that users can still receive meaningful error

- -

See also

- -

miss_var_summary

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/table_missing_case.html b/docs/reference/table_missing_case.html deleted file mode 100644 index d1072d47..00000000 --- a/docs/reference/table_missing_case.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - -Tabulate missings in cases. — table_missing_case • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Deprecated as of version 0.0.6.9000. Please use miss_case_table instead.

- - -
table_missing_case(...)
- -

Arguments

- - - - - - -
...

so that users can still receive meaningful error

- -

See also

- -

miss_case_table

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/table_missing_var.html b/docs/reference/table_missing_var.html deleted file mode 100644 index d43d8908..00000000 --- a/docs/reference/table_missing_var.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - -Tabulate the missings in the variables — table_missing_var • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Deprecated as of version 0.0.6.9000. Please use miss_var_table instead.

- - -
table_missing_var(...)
- -

Arguments

- - - - - - -
...

so that users can still receive meaningful error

- -

See also

- -

miss_var_table

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/tao.html b/docs/reference/tao.html deleted file mode 100644 index 06cb9859..00000000 --- a/docs/reference/tao.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - -West Pacific Tropical Atmosphere Ocean Data, 1993 & 1997. — tao • narnia - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -

Real-time data from moored ocean buoys for improved detection, -understanding and prediction of El Ni'o and La Ni'a.

- - -
data(tao)
- -

Source

- -

http://www.pmel.noaa.gov/tao/data_deliv/deliv.html

- -

Details

- -

The data is collected by the Tropical Atmosphere Ocean project ( -http://www.pmel.noaa.gov/tao/index.shtml).

-

Format: a data frame with 736 observations on the following 8 -variables.

-
latitude

A factor with -levels -5 -2 0.

longitude

A -factor with levels -110 -95.

-
sea.surface.temp

Sea surface temperature(degree -Celsius), measured by the TAO buoys at one meter below the -surface.

air.temp

Air temperature(degree Celsius), -measured by the TAO buoys three meters above the sea surface.

-
humidity

Relative humidity( -buoys 3 meters above the sea surface.

uwind

The -East-West wind vector components(M/s). TAO buoys measure the wind -speed and direction four meters above the sea surface. If it is -positive, the East-West component of the wind is blowing towards -the East. If it is negative, this component is blowing towards the -West.

vwind

The North-South wind vector -components(M/s). TAO buoys measure the wind speed and direction -four meters above the sea surface. If it is positive, the -North-South component of the wind is blowing towards the North. -If it is negative, this component is blowing towards the South.

- -

See also

- -

library(MissingDataGUI)

- - -
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - diff --git a/docs/reference/test_if_dataframe.html b/docs/reference/test_if_dataframe.html deleted file mode 100644 index e1c19199..00000000 --- a/docs/reference/test_if_dataframe.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - -Test if input is a data.frame — test_if_dataframe • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Test if input is a data.frame

-
- -
test_if_dataframe(x)
- -

Arguments

- - - - - - -
x

object

- -

Value

- -

an error if input (x) is a data.frame

- -

Examples

-
if (FALSE) { -# success -test_if_dataframe(airquality) -#fail -my_test <- matrix(10) -test_if_dataframe(my_test) -}
-
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/test_if_missing.html b/docs/reference/test_if_missing.html deleted file mode 100644 index 94070b87..00000000 --- a/docs/reference/test_if_missing.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - -Test if the input is Missing — test_if_missing • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Test if the input is Missing

-
- -
test_if_missing(x)
- -

Arguments

- - - - - - -
x

object

- -

Value

- -

an error if input (x) is not specified

- -

Examples

-
if (FALSE) { -# success -my_test <- x -test_if_null(my_test) -#fail -test_if_missing() -}
-
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/test_if_null.html b/docs/reference/test_if_null.html deleted file mode 100644 index 0f660714..00000000 --- a/docs/reference/test_if_null.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - -Test if the input is NULL — test_if_null • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Test if the input is NULL

-
- -
test_if_null(x)
- -

Arguments

- - - - - - -
x

object

- -

Value

- -

an error if input (x) is NULL

- -

Examples

-
if (FALSE) { -# success -test_if_null(airquality) -#fail -my_test <- NULL -test_if_null(my_test) -}
-
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/test_if_shadow.html b/docs/reference/test_if_shadow.html deleted file mode 100644 index 40fd7654..00000000 --- a/docs/reference/test_if_shadow.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - -Test if input is a shadow — test_if_shadow • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

Test if input is a shadow

- -
- -
test_if_shadow(x)
- -

Arguments

- - - - - - -
x

object

- -

Value

- -

an error if input (x) is a shadow

- - -

Examples

-
# NOT RUN {
-# success
-aq_shadow <- bind_shadow(airquality)
-test_if_shadow(aq_shadow)
-#fail
-test_if_shadow(airquality)
-# }
-
-
- -
- -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - - - - diff --git a/docs/reference/unbinders.html b/docs/reference/unbinders.html deleted file mode 100644 index 0bdb7807..00000000 --- a/docs/reference/unbinders.html +++ /dev/null @@ -1,175 +0,0 @@ - -Unbind (remove) shadow from data, and vice versa — unbinders • naniar - Skip to contents - - -
-
-
- -
-

Remove the shadow variables (which end in _NA) from the data, or vice versa. -This will also remove the nabular class from the data.

-
- -
-

Usage

-
unbind_shadow(data)
-
-unbind_data(data)
-
- -
-

Arguments

-
data
-

data.frame containing shadow columns (created by bind_shadow())

- -
-
-

Value

- - -

data.frame without shadow columns if using unbind_shadow(), or -without the original data, if using unbind_data().

-
- -
-

Examples

-

-# bind shadow columns
-aq_sh <- bind_shadow(airquality)
-
-# print data
-aq_sh
-#> # A tibble: 153 × 12
-#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA Wind_NA Temp_NA
-#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>      <fct>   <fct>  
-#>  1    41     190   7.4    67     5     1 !NA      !NA        !NA     !NA    
-#>  2    36     118   8      72     5     2 !NA      !NA        !NA     !NA    
-#>  3    12     149  12.6    74     5     3 !NA      !NA        !NA     !NA    
-#>  4    18     313  11.5    62     5     4 !NA      !NA        !NA     !NA    
-#>  5    NA      NA  14.3    56     5     5 NA       NA         !NA     !NA    
-#>  6    28      NA  14.9    66     5     6 !NA      NA         !NA     !NA    
-#>  7    23     299   8.6    65     5     7 !NA      !NA        !NA     !NA    
-#>  8    19      99  13.8    59     5     8 !NA      !NA        !NA     !NA    
-#>  9     8      19  20.1    61     5     9 !NA      !NA        !NA     !NA    
-#> 10    NA     194   8.6    69     5    10 NA       !NA        !NA     !NA    
-#> # ℹ 143 more rows
-#> # ℹ 2 more variables: Month_NA <fct>, Day_NA <fct>
-
-# remove shadow columns
-unbind_shadow(aq_sh)
-#> # A tibble: 153 × 6
-#>    Ozone Solar.R  Wind  Temp Month   Day
-#>    <int>   <int> <dbl> <int> <int> <int>
-#>  1    41     190   7.4    67     5     1
-#>  2    36     118   8      72     5     2
-#>  3    12     149  12.6    74     5     3
-#>  4    18     313  11.5    62     5     4
-#>  5    NA      NA  14.3    56     5     5
-#>  6    28      NA  14.9    66     5     6
-#>  7    23     299   8.6    65     5     7
-#>  8    19      99  13.8    59     5     8
-#>  9     8      19  20.1    61     5     9
-#> 10    NA     194   8.6    69     5    10
-#> # ℹ 143 more rows
-
-# remove data
-unbind_data(aq_sh)
-#> # A tibble: 153 × 6
-#>    Ozone_NA Solar.R_NA Wind_NA Temp_NA Month_NA Day_NA
-#>    <fct>    <fct>      <fct>   <fct>   <fct>    <fct> 
-#>  1 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  2 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  3 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  4 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  5 NA       NA         !NA     !NA     !NA      !NA   
-#>  6 !NA      NA         !NA     !NA     !NA      !NA   
-#>  7 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  8 !NA      !NA        !NA     !NA     !NA      !NA   
-#>  9 !NA      !NA        !NA     !NA     !NA      !NA   
-#> 10 NA       !NA        !NA     !NA     !NA      !NA   
-#> # ℹ 143 more rows
-
-# errors when you don't use data with shadows
-if (FALSE) {
- unbind_data(airquality)
- unbind_shadow(airquality)
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/update_shadow.html b/docs/reference/update_shadow.html deleted file mode 100644 index 3d699b13..00000000 --- a/docs/reference/update_shadow.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - - - -Expand all shadow levels — update_shadow • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

Internal function to appropriately expand and relevel all shadow variables to include a new suffix

-
- -
update_shadow(data, suffix)
- -

Arguments

- - - - - - - - - - -
data

data.frame

suffix

character vector

- -

Value

- -

data.frame with adjusted levels

- -

Examples

-
if (FALSE) { -df <- tibble::tribble( -~wind, ~temp, --99, 45, -68, NA, -72, 25 -) - - -dfs <- bind_shadow(df) - -update_shadow(dfs, "weee") -update_shadow(dfs, "weee") %>% what_levels() -}
-
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/what_levels.html b/docs/reference/what_levels.html deleted file mode 100644 index ed3c3723..00000000 --- a/docs/reference/what_levels.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - -check the levels of many things — what_levels • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
-

this function is used internally to check what the levels are of the dataframe.

-
- -
what_levels(x)
- -

Arguments

- - - - - - -
x

data.frame, usually

- -

Value

- -

a list containing the levels of everything

- -
- -
- - -
- - -
-

Site built with pkgdown 1.4.1.

-
- -
-
- - - - - - - - - - - diff --git a/docs/reference/where.html b/docs/reference/where.html deleted file mode 100644 index 8c8b6581..00000000 --- a/docs/reference/where.html +++ /dev/null @@ -1,129 +0,0 @@ - -Split a call into two components with a useful verb name — where • naniar - Skip to contents - - -
-
-
- -
-

This function is used inside recode_shadow to help evaluate the formula -call effectively. .where is a special function designed for use in -recode_shadow, and you shouldn't use it outside of it

-
- -
-

Usage

-
.where(...)
-
- -
-

Arguments

-
...
-

case_when style formula

- -
-
-

Value

- - -

a list of "condition" and "suffix" arguments

-
- -
-

Examples

-

-if (FALSE) {
-df <- tibble::tribble(
-~wind, ~temp,
--99,    45,
-68,    NA,
-72,    25
-)
-
-dfs <- bind_shadow(df)
-
-recode_shadow(dfs,
-              temp = .where(wind == -99 ~ "bananas"))
-
-}
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/where_na.html b/docs/reference/where_na.html deleted file mode 100644 index 1c142ad5..00000000 --- a/docs/reference/where_na.html +++ /dev/null @@ -1,165 +0,0 @@ - -Which rows and cols contain missings? — where_na • naniar - Skip to contents - - -
-
-
- -
-

Internal function that is short for which(is.na(x), arr.ind = TRUE). -Creates array index locations of missing values in a dataframe.

-
- -
-

Usage

-
where_na(x)
-
- -
-

Arguments

-
x
-

a dataframe

- -
-
-

Value

- - -

a matrix with columns "row" and "col", which refer to the row and -column that identify the position of a missing value in a dataframe

-
-
-

See also

- -
- -
-

Examples

-

-where_na(airquality)
-#>       row col
-#>  [1,]   5   1
-#>  [2,]  10   1
-#>  [3,]  25   1
-#>  [4,]  26   1
-#>  [5,]  27   1
-#>  [6,]  32   1
-#>  [7,]  33   1
-#>  [8,]  34   1
-#>  [9,]  35   1
-#> [10,]  36   1
-#> [11,]  37   1
-#> [12,]  39   1
-#> [13,]  42   1
-#> [14,]  43   1
-#> [15,]  45   1
-#> [16,]  46   1
-#> [17,]  52   1
-#> [18,]  53   1
-#> [19,]  54   1
-#> [20,]  55   1
-#> [21,]  56   1
-#> [22,]  57   1
-#> [23,]  58   1
-#> [24,]  59   1
-#> [25,]  60   1
-#> [26,]  61   1
-#> [27,]  65   1
-#> [28,]  72   1
-#> [29,]  75   1
-#> [30,]  83   1
-#> [31,]  84   1
-#> [32,] 102   1
-#> [33,] 103   1
-#> [34,] 107   1
-#> [35,] 115   1
-#> [36,] 119   1
-#> [37,] 150   1
-#> [38,]   5   2
-#> [39,]   6   2
-#> [40,]  11   2
-#> [41,]  27   2
-#> [42,]  96   2
-#> [43,]  97   2
-#> [44,]  98   2
-where_na(oceanbuoys$sea_temp_c)
-#> [1] 463 481 637
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/which_are_shade.html b/docs/reference/which_are_shade.html deleted file mode 100644 index d284bd0d..00000000 --- a/docs/reference/which_are_shade.html +++ /dev/null @@ -1,114 +0,0 @@ - -Which variables are shades? — which_are_shade • naniar - Skip to contents - - -
-
-
- -
-

This function tells us which variables contain shade information

-
- -
-

Usage

-
which_are_shade(.tbl)
-
- -
-

Arguments

-
.tbl
-

a data.frame or tbl

- -
-
-

Value

- - -

numeric - which column numbers contain shade information

-
- -
-

Examples

-

-df_shadow <- bind_shadow(airquality)
-
-which_are_shade(df_shadow)
-#>   Ozone_NA Solar.R_NA    Wind_NA    Temp_NA   Month_NA     Day_NA 
-#>          7          8          9         10         11         12 
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/which_na.html b/docs/reference/which_na.html deleted file mode 100644 index 2f48ad25..00000000 --- a/docs/reference/which_na.html +++ /dev/null @@ -1,117 +0,0 @@ - -Which elements contain missings? — which_na • naniar - Skip to contents - - -
-
-
- -
-

Equivalent to which(is.na()) - returns integer locations of missing values.

-
- -
-

Usage

-
which_na(x)
-
- -
-

Arguments

-
x
-

a dataframe

- -
-
-

Value

- - -

integer locations of missing values.

-
-
-

See also

- -
- -
-

Examples

-

-which_na(airquality)
-#>  [1]   5  10  25  26  27  32  33  34  35  36  37  39  42  43  45  46  52  53  54
-#> [20]  55  56  57  58  59  60  61  65  72  75  83  84 102 103 107 115 119 150 158
-#> [39] 159 164 180 249 250 251
-
-
-
-
- - -
- - - - - - - diff --git a/docs/reference/which_var_na.html b/docs/reference/which_var_na.html deleted file mode 100644 index 7a91a298..00000000 --- a/docs/reference/which_var_na.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - -Which variables contain missing values? — which_var_na • naniar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

It can be helpful when writing other functions to just return the names -of the variables that contain missing values.

- -
- -
which_var_na(data)
- -

Arguments

- - - - - - -
data

a data.frame

- -

Value

- -

character vector of variable names

- - -

Examples

-
# NOT RUN {
-which_var_na(airquality)
-
-which_var_na(iris)
-# }
-
-
- -
- -
- - -
-

Site built with pkgdown.

-
- -
-
- - - - - - diff --git a/docs/sitemap.xml b/docs/sitemap.xml deleted file mode 100644 index 3956c243..00000000 --- a/docs/sitemap.xml +++ /dev/null @@ -1,507 +0,0 @@ - - - - http://naniar.njtierney.com/404.html - - - http://naniar.njtierney.com/CONDUCT.html - - - http://naniar.njtierney.com/CONTRIBUTING.html - - - http://naniar.njtierney.com/LICENSE-text.html - - - http://naniar.njtierney.com/LICENSE.html - - - http://naniar.njtierney.com/articles/exploring-imputed-values.html - - - http://naniar.njtierney.com/articles/getting-started-w-naniar.html - - - http://naniar.njtierney.com/articles/getting-started-w-narnia.html - - - http://naniar.njtierney.com/articles/index.html - - - http://naniar.njtierney.com/articles/naniar-visualisation.html - - - http://naniar.njtierney.com/articles/replace-with-na.html - - - http://naniar.njtierney.com/articles/special-missing-values.html - - - http://naniar.njtierney.com/authors.html - - - http://naniar.njtierney.com/index.html - - - http://naniar.njtierney.com/issue_template.html - - - http://naniar.njtierney.com/news/index.html - - - http://naniar.njtierney.com/pull_request_template.html - - - http://naniar.njtierney.com/reference/add_any_miss.html - - - http://naniar.njtierney.com/reference/add_label_missings.html - - - http://naniar.njtierney.com/reference/add_label_shadow.html - - - http://naniar.njtierney.com/reference/add_miss_cluster.html - - - http://naniar.njtierney.com/reference/add_n_miss.html - - - http://naniar.njtierney.com/reference/add_prop_miss.html - - - http://naniar.njtierney.com/reference/add_shadow.html - - - http://naniar.njtierney.com/reference/add_shadow_shift.html - - - http://naniar.njtierney.com/reference/add_span_counter.html - - - http://naniar.njtierney.com/reference/all-is-miss-complete.html - - - http://naniar.njtierney.com/reference/all_row_complete.html - - - http://naniar.njtierney.com/reference/all_row_miss.html - - - http://naniar.njtierney.com/reference/any-na.html - - - http://naniar.njtierney.com/reference/any_row_miss.html - - - http://naniar.njtierney.com/reference/are_shadow.html - - - http://naniar.njtierney.com/reference/as_shadow.data.frame.html - - - http://naniar.njtierney.com/reference/as_shadow.html - - - http://naniar.njtierney.com/reference/as_shadow_upset.html - - - http://naniar.njtierney.com/reference/bind_shadow.html - - - http://naniar.njtierney.com/reference/brfss.html - - - http://naniar.njtierney.com/reference/cast_shadow.html - - - http://naniar.njtierney.com/reference/cast_shadow_shift.html - - - http://naniar.njtierney.com/reference/cast_shadow_shift_label.html - - - http://naniar.njtierney.com/reference/common_na_numbers.html - - - http://naniar.njtierney.com/reference/common_na_strings.html - - - http://naniar.njtierney.com/reference/draw_key.html - - - http://naniar.njtierney.com/reference/gather_shadow.html - - - http://naniar.njtierney.com/reference/geom_miss_point.html - - - http://naniar.njtierney.com/reference/geom_missing_point.html - - - http://naniar.njtierney.com/reference/gg_miss_case.html - - - http://naniar.njtierney.com/reference/gg_miss_case_cumsum.html - - - http://naniar.njtierney.com/reference/gg_miss_fct.html - - - http://naniar.njtierney.com/reference/gg_miss_span.html - - - http://naniar.njtierney.com/reference/gg_miss_upset.html - - - http://naniar.njtierney.com/reference/gg_miss_var.html - - - http://naniar.njtierney.com/reference/gg_miss_var_cumsum.html - - - http://naniar.njtierney.com/reference/gg_miss_which.html - - - http://naniar.njtierney.com/reference/gg_missing_case.html - - - http://naniar.njtierney.com/reference/gg_missing_var.html - - - http://naniar.njtierney.com/reference/gg_missing_which.html - - - http://naniar.njtierney.com/reference/group_by_fun.html - - - http://naniar.njtierney.com/reference/impute_below.html - - - http://naniar.njtierney.com/reference/impute_below_all.html - - - http://naniar.njtierney.com/reference/impute_below_at.html - - - http://naniar.njtierney.com/reference/impute_below_if.html - - - http://naniar.njtierney.com/reference/impute_knn.html - - - http://naniar.njtierney.com/reference/impute_mean.html - - - http://naniar.njtierney.com/reference/impute_median.html - - - http://naniar.njtierney.com/reference/impute_shift.html - - - http://naniar.njtierney.com/reference/impute_shift_at.html - - - http://naniar.njtierney.com/reference/impute_shift_if.html - - - http://naniar.njtierney.com/reference/index.html - - - http://naniar.njtierney.com/reference/is_shade.html - - - http://naniar.njtierney.com/reference/is_shadow.html - - - http://naniar.njtierney.com/reference/label_miss_1d.html - - - http://naniar.njtierney.com/reference/label_miss_2d.html - - - http://naniar.njtierney.com/reference/label_missing_1d.html - - - http://naniar.njtierney.com/reference/label_missing_2d.html - - - http://naniar.njtierney.com/reference/label_missings.html - - - http://naniar.njtierney.com/reference/label_na.html - - - http://naniar.njtierney.com/reference/label_shadow.html - - - http://naniar.njtierney.com/reference/label_shadow_matrix.html - - - http://naniar.njtierney.com/reference/mcar_test.html - - - http://naniar.njtierney.com/reference/miss-complete-case-pct.html - - - http://naniar.njtierney.com/reference/miss-complete-case-prop.html - - - http://naniar.njtierney.com/reference/miss-complete-var-pct.html - - - http://naniar.njtierney.com/reference/miss-complete-var-prop.html - - - http://naniar.njtierney.com/reference/miss-pct-prop-defunct.html - - - http://naniar.njtierney.com/reference/miss_case_cumsum.html - - - http://naniar.njtierney.com/reference/miss_case_pct.html - - - http://naniar.njtierney.com/reference/miss_case_prop.html - - - http://naniar.njtierney.com/reference/miss_case_summary.html - - - http://naniar.njtierney.com/reference/miss_case_table.html - - - http://naniar.njtierney.com/reference/miss_df_pct.html - - - http://naniar.njtierney.com/reference/miss_prop_summary.html - - - http://naniar.njtierney.com/reference/miss_scan_count.html - - - http://naniar.njtierney.com/reference/miss_summary.html - - - http://naniar.njtierney.com/reference/miss_var_cumsum.html - - - http://naniar.njtierney.com/reference/miss_var_pct.html - - - http://naniar.njtierney.com/reference/miss_var_prop.html - - - http://naniar.njtierney.com/reference/miss_var_run.html - - - http://naniar.njtierney.com/reference/miss_var_span.html - - - http://naniar.njtierney.com/reference/miss_var_summary.html - - - http://naniar.njtierney.com/reference/miss_var_table.html - - - http://naniar.njtierney.com/reference/miss_var_which.html - - - http://naniar.njtierney.com/reference/n-var-case-complete.html - - - http://naniar.njtierney.com/reference/n-var-case-miss.html - - - http://naniar.njtierney.com/reference/n_complete.html - - - http://naniar.njtierney.com/reference/n_complete_row.html - - - http://naniar.njtierney.com/reference/n_miss.html - - - http://naniar.njtierney.com/reference/n_miss_row.html - - - http://naniar.njtierney.com/reference/nabular.html - - - http://naniar.njtierney.com/reference/naniar-ggproto.html - - - http://naniar.njtierney.com/reference/naniar.html - - - http://naniar.njtierney.com/reference/narnia-ggproto.html - - - http://naniar.njtierney.com/reference/narnia.html - - - http://naniar.njtierney.com/reference/new_nabular.html - - - http://naniar.njtierney.com/reference/new_shade.html - - - http://naniar.njtierney.com/reference/new_shadow.html - - - http://naniar.njtierney.com/reference/oceanbuoys.html - - - http://naniar.njtierney.com/reference/pct-miss-complete-case.html - - - http://naniar.njtierney.com/reference/pct-miss-complete-var.html - - - http://naniar.njtierney.com/reference/pct_complete.html - - - http://naniar.njtierney.com/reference/pct_miss.html - - - http://naniar.njtierney.com/reference/pedestrian.html - - - http://naniar.njtierney.com/reference/percent_missing_case.html - - - http://naniar.njtierney.com/reference/percent_missing_df.html - - - http://naniar.njtierney.com/reference/percent_missing_var.html - - - http://naniar.njtierney.com/reference/plotly_helpers.html - - - http://naniar.njtierney.com/reference/prop-miss-complete-case.html - - - http://naniar.njtierney.com/reference/prop-miss-complete-var.html - - - http://naniar.njtierney.com/reference/prop_complete.html - - - http://naniar.njtierney.com/reference/prop_complete_row.html - - - http://naniar.njtierney.com/reference/prop_miss.html - - - http://naniar.njtierney.com/reference/prop_miss_row.html - - - http://naniar.njtierney.com/reference/recode_shadow.html - - - http://naniar.njtierney.com/reference/reexports.html - - - http://naniar.njtierney.com/reference/replace_to_na.html - - - http://naniar.njtierney.com/reference/replace_with_na.html - - - http://naniar.njtierney.com/reference/replace_with_na_all.html - - - http://naniar.njtierney.com/reference/replace_with_na_at.html - - - http://naniar.njtierney.com/reference/replace_with_na_if.html - - - http://naniar.njtierney.com/reference/riskfactors.html - - - http://naniar.njtierney.com/reference/scoped-impute_mean.html - - - http://naniar.njtierney.com/reference/scoped-impute_median.html - - - http://naniar.njtierney.com/reference/set-prop-n-miss.html - - - http://naniar.njtierney.com/reference/shade.html - - - http://naniar.njtierney.com/reference/shadow_expand_relevel.html - - - http://naniar.njtierney.com/reference/shadow_long.html - - - http://naniar.njtierney.com/reference/shadow_shift.html - - - http://naniar.njtierney.com/reference/shadow_shift.numeric.html - - - http://naniar.njtierney.com/reference/stat_miss_point.html - - - http://naniar.njtierney.com/reference/stat_missing_point.html - - - http://naniar.njtierney.com/reference/summarise_missingness.html - - - http://naniar.njtierney.com/reference/summary_missing_case.html - - - http://naniar.njtierney.com/reference/summary_missing_var.html - - - http://naniar.njtierney.com/reference/table_missing_case.html - - - http://naniar.njtierney.com/reference/table_missing_var.html - - - http://naniar.njtierney.com/reference/tao.html - - - http://naniar.njtierney.com/reference/test_if_dataframe.html - - - http://naniar.njtierney.com/reference/test_if_missing.html - - - http://naniar.njtierney.com/reference/test_if_null.html - - - http://naniar.njtierney.com/reference/test_if_shadow.html - - - http://naniar.njtierney.com/reference/unbinders.html - - - http://naniar.njtierney.com/reference/update_shadow.html - - - http://naniar.njtierney.com/reference/what_levels.html - - - http://naniar.njtierney.com/reference/where.html - - - http://naniar.njtierney.com/reference/where_na.html - - - http://naniar.njtierney.com/reference/which_are_shade.html - - - http://naniar.njtierney.com/reference/which_na.html - - - http://naniar.njtierney.com/reference/which_var_na.html - - diff --git a/man/geom_miss_point.Rd b/man/geom_miss_point.Rd index fdf1153f..f92941af 100644 --- a/man/geom_miss_point.Rd +++ b/man/geom_miss_point.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/geom-miss-point.R \name{geom_miss_point} \alias{geom_miss_point} -\title{geom_miss_point} +\title{Plot Missing Data Points} \usage{ geom_miss_point( mapping = NULL, @@ -67,11 +67,8 @@ values in ggplot2. To do so it uses methods from ggobi to display missing data points 10\\% below the minimum value, so that the values can be seen on the same axis. } -\details{ -Plot Missing Data Points -} \note{ -Warning message if na.rm = T is supplied. +Warning message if \code{na.rm = T} is supplied. } \examples{ \dontrun{ @@ -99,5 +96,6 @@ ggplot(airquality, } } \seealso{ -[gg_miss_case()][gg_miss_case_cumsum()][gg_miss_fct()][gg_miss_span()][gg_miss_var()][gg_miss_var_cumsum()][gg_miss_which()] +\code{\link[=gg_miss_case]{gg_miss_case()}} \code{\link[=gg_miss_case_cumsum]{gg_miss_case_cumsum()}} \code{\link[=gg_miss_fct]{gg_miss_fct()}} +\code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} } diff --git a/man/gg_miss_case.Rd b/man/gg_miss_case.Rd index aeb90d38..e82d2cdd 100644 --- a/man/gg_miss_case.Rd +++ b/man/gg_miss_case.Rd @@ -38,5 +38,5 @@ gg_miss_case(airquality, facet = Month, show_pct = TRUE) } } \seealso{ -\code{\link[=geom_miss_point]{geom_miss_point()}} \link{gg_miss_case_cumsum} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} +\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case_cumsum]{gg_miss_case_cumsum()}} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} } diff --git a/man/gg_miss_fct.Rd b/man/gg_miss_fct.Rd index 3bd00745..6adc80d5 100644 --- a/man/gg_miss_fct.Rd +++ b/man/gg_miss_fct.Rd @@ -30,5 +30,5 @@ gg_miss_fct(x = riskfactors, fct = marital) + labs(title = "NA in Risk Factors a } \seealso{ -\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \link{gg_miss_case_cumsum} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} +\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \code{\link[=gg_miss_case_cumsum]{gg_miss_case_cumsum()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} } diff --git a/man/gg_miss_span.Rd b/man/gg_miss_span.Rd index d62af96c..26d8e9e3 100644 --- a/man/gg_miss_span.Rd +++ b/man/gg_miss_span.Rd @@ -37,5 +37,5 @@ gg_miss_span(pedestrian, hourly_counts, span_every = 3000) + theme_dark() } } \seealso{ -\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \link{gg_miss_case_cumsum} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} +\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \code{\link[=gg_miss_case_cumsum]{gg_miss_case_cumsum()}} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} } diff --git a/man/gg_miss_var.Rd b/man/gg_miss_var.Rd index 6763376a..8d608d6a 100644 --- a/man/gg_miss_var.Rd +++ b/man/gg_miss_var.Rd @@ -35,5 +35,5 @@ gg_miss_var(airquality, Month, show_pct = TRUE) + ylim(0, 100) } } \seealso{ -\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \link{gg_miss_case_cumsum} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} +\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \code{\link[=gg_miss_case_cumsum]{gg_miss_case_cumsum()}} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} } diff --git a/man/gg_miss_var_cumsum.Rd b/man/gg_miss_var_cumsum.Rd index 2735b082..0b91a751 100644 --- a/man/gg_miss_var_cumsum.Rd +++ b/man/gg_miss_var_cumsum.Rd @@ -22,5 +22,5 @@ default minimal theme is used, which can be customised as normal for ggplot. gg_miss_var_cumsum(airquality) } \seealso{ -\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \link{gg_miss_case_cumsum} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_which]{gg_miss_which()}} +\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \code{\link[=gg_miss_case_cumsum]{gg_miss_case_cumsum()}} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_which]{gg_miss_which()}} } diff --git a/man/gg_miss_which.Rd b/man/gg_miss_which.Rd index 4d81bc8f..3dcda2d1 100644 --- a/man/gg_miss_which.Rd +++ b/man/gg_miss_which.Rd @@ -22,5 +22,5 @@ customised as normal for ggplot. gg_miss_which(airquality) } \seealso{ -\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \link{gg_miss_case_cumsum} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} +\code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \code{\link[=gg_miss_case_cumsum]{gg_miss_case_cumsum()}} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} } diff --git a/man/naniar.Rd b/man/naniar.Rd index 329c5f88..b94577da 100644 --- a/man/naniar.Rd +++ b/man/naniar.Rd @@ -4,7 +4,7 @@ \name{naniar} \alias{naniar-package} \alias{naniar} -\title{naniar} +\title{naniar: Data Structures, Summaries, and Visualisations for Missing Data} \description{ naniar is a package to make it easier to summarise and handle missing values in R. It strives to do this in a way that is as consistent with tidyverse @@ -12,7 +12,13 @@ principles as possible. The work is fully discussed at Tierney & Cook (2023) \url{doi:10.18637/jss.v105.i07}. } \seealso{ -\code{\link[=add_any_miss]{add_any_miss()}} \code{\link[=add_label_missings]{add_label_missings()}} \code{\link[=add_label_shadow]{add_label_shadow()}} \code{\link[=add_miss_cluster]{add_miss_cluster()}} \code{\link[=add_n_miss]{add_n_miss()}} \code{\link[=add_prop_miss]{add_prop_miss()}} \code{\link[=add_shadow]{add_shadow()}} \code{\link[=add_shadow_shift]{add_shadow_shift()}} \code{\link[=as_shadow]{as_shadow()}} \code{\link[=bind_shadow]{bind_shadow()}} \code{\link[=cast_shadow]{cast_shadow()}} \code{\link[=cast_shadow_shift]{cast_shadow_shift()}} \code{\link[=cast_shadow_shift_label]{cast_shadow_shift_label()}} \code{\link[=draw_key_missing_point]{draw_key_missing_point()}} \code{\link[=gather_shadow]{gather_shadow()}} \code{\link[=geom_miss_point]{geom_miss_point()}} \code{\link[=gg_miss_case]{gg_miss_case()}} \code{\link[=gg_miss_case_cumsum]{gg_miss_case_cumsum()}} \code{\link[=gg_miss_fct]{gg_miss_fct()}} \code{\link[=gg_miss_span]{gg_miss_span()}} \code{\link[=gg_miss_var]{gg_miss_var()}} \code{\link[=gg_miss_var_cumsum]{gg_miss_var_cumsum()}} \code{\link[=gg_miss_which]{gg_miss_which()}} \code{\link[=label_miss_1d]{label_miss_1d()}} \code{\link[=label_miss_2d]{label_miss_2d()}} \code{\link[=label_missings]{label_missings()}} \code{\link[=pct_miss_case]{pct_miss_case()}} \code{\link[=prop_miss_case]{prop_miss_case()}} \code{\link[=pct_miss_var]{pct_miss_var()}} \code{\link[=prop_miss_var]{prop_miss_var()}} \code{\link[=pct_complete_case]{pct_complete_case()}} \code{\link[=prop_complete_case]{prop_complete_case()}} \code{\link[=pct_complete_var]{pct_complete_var()}} \code{\link[=prop_complete_var]{prop_complete_var()}} \code{\link[=miss_prop_summary]{miss_prop_summary()}} \code{\link[=miss_case_summary]{miss_case_summary()}} \code{\link[=miss_case_table]{miss_case_table()}} \code{\link[=miss_summary]{miss_summary()}} \code{\link[=miss_var_prop]{miss_var_prop()}} \code{\link[=miss_var_run]{miss_var_run()}} \code{\link[=miss_var_span]{miss_var_span()}} \code{\link[=miss_var_summary]{miss_var_summary()}} \code{\link[=miss_var_table]{miss_var_table()}} \code{\link[=n_complete]{n_complete()}} \code{\link[=n_complete_row]{n_complete_row()}} \code{\link[=n_miss]{n_miss()}} \code{\link[=n_miss_row]{n_miss_row()}} \code{\link[=pct_complete]{pct_complete()}} \code{\link[=pct_miss]{pct_miss()}} \code{\link[=prop_complete]{prop_complete()}} \code{\link[=prop_complete_row]{prop_complete_row()}} \code{\link[=prop_miss]{prop_miss()}} \code{\link[=prop_miss_row]{prop_miss_row()}} \code{\link[=replace_to_na]{replace_to_na()}} \code{\link[=replace_with_na]{replace_with_na()}} \code{\link[=replace_with_na_all]{replace_with_na_all()}} \code{\link[=replace_with_na_at]{replace_with_na_at()}} \code{\link[=replace_with_na_if]{replace_with_na_if()}} \code{\link[=shadow_shift]{shadow_shift()}} \code{\link[=stat_miss_point]{stat_miss_point()}} \code{\link[=vis_miss]{vis_miss()}} \code{\link[=where_na]{where_na()}} +Useful links: +\itemize{ + \item \url{https://github.com/njtierney/naniar} + \item \url{https://naniar.njtierney.com/} + \item Report bugs at \url{https://github.com/njtierney/naniar/issues} +} + } \author{ \strong{Maintainer}: Nicholas Tierney \email{nicholas.tierney@gmail.com} (\href{https://orcid.org/0000-0003-1460-8722}{ORCID}) diff --git a/man/reexports.Rd b/man/reexports.Rd index 938e9db2..c2e3846e 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -1,12 +1,12 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/naniar-package.R, R/utils.R +% Please edit documentation in R/utils.R \docType{import} \name{reexports} \alias{reexports} -\alias{vis_miss} \alias{\%>\%} \alias{is_na} \alias{are_na} +\alias{vis_miss} \title{Objects exported from other packages} \keyword{internal} \description{ diff --git a/tests/testthat/test-special-missing-values.R b/tests/testthat/test-special-missing-values.R index 137ac37b..d8ebd074 100644 --- a/tests/testthat/test-special-missing-values.R +++ b/tests/testthat/test-special-missing-values.R @@ -139,10 +139,11 @@ test_that("special missings are the same for grouped and ungrouped data", { test_that("special missings class is maintained for grouped and ungrouped data", { skip_on_cran() skip_on_ci() + # FIXME failing test? expect_equal(class(aq_grouped_recoded$Ozone_NA), class(aq_recoded$Ozone_NA)) - expect_true(is_shade(aq_grouped_recoded$Ozone_NA), - is_shade(aq_recoded$Ozone_NA)) + expect_true(is_shade(aq_grouped_recoded$Ozone_NA)) + expect_true(is_shade(aq_recoded$Ozone_NA)) }) test_that("shadow_expand_relevel returns shadows inside a data.frame", { diff --git a/vignettes/getting-started-w-narnia_files/figure-html/ggmissing-theme-1.png b/vignettes/getting-started-w-narnia_files/figure-html/ggmissing-theme-1.png deleted file mode 100755 index 835ad1c3..00000000 Binary files a/vignettes/getting-started-w-narnia_files/figure-html/ggmissing-theme-1.png and /dev/null differ diff --git a/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-1-1.png b/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-1-1.png deleted file mode 100755 index 75bf05e8..00000000 Binary files a/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-1-1.png and /dev/null differ diff --git a/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-1.png b/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-1.png deleted file mode 100755 index b64c71e8..00000000 Binary files a/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-1.png and /dev/null differ diff --git a/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-2.png b/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-2.png deleted file mode 100755 index 93025ce6..00000000 Binary files a/vignettes/getting-started-w-narnia_files/figure-html/unnamed-chunk-2-2.png and /dev/null differ diff --git a/vignettes/getting-started-w-narnia_files/figure-html/vis-dat-1.png b/vignettes/getting-started-w-narnia_files/figure-html/vis-dat-1.png deleted file mode 100755 index e03c5497..00000000 Binary files a/vignettes/getting-started-w-narnia_files/figure-html/vis-dat-1.png and /dev/null differ diff --git a/vignettes/getting-started-w-narnia_files/figure-html/vis-miss-cluster-vanilla-1.png b/vignettes/getting-started-w-narnia_files/figure-html/vis-miss-cluster-vanilla-1.png deleted file mode 100755 index 8270e003..00000000 Binary files a/vignettes/getting-started-w-narnia_files/figure-html/vis-miss-cluster-vanilla-1.png and /dev/null differ diff --git a/vignettes/naniar-visualisation.Rmd b/vignettes/naniar-visualisation.Rmd index cc7789e9..fd07ded5 100644 --- a/vignettes/naniar-visualisation.Rmd +++ b/vignettes/naniar-visualisation.Rmd @@ -17,7 +17,7 @@ knitr::opts_chunk$set(fig.align = "center", ``` -There are a variety of different plots to explore missing data available in the naniar package. This vignette simply showcases all of the visualisations. If you would like to know more about the philosophy of the `naniar` package, you should read the vignette [Getting Started with naniar](http://naniar.njtierney.com/articles/getting-started-w-naniar.html). +There are a variety of different plots to explore missing data available in the naniar package. This vignette simply showcases all of the visualisations. If you would like to know more about the philosophy of the `naniar` package, you should read `vignette("naniar")`. A key point to remember with the visualisation tools in `naniar` is that there is a way to get the data from the plot out from the visualisation. diff --git a/vignettes/getting-started-w-naniar.Rmd b/vignettes/naniar.Rmd similarity index 99% rename from vignettes/getting-started-w-naniar.Rmd rename to vignettes/naniar.Rmd index add8786d..282d4b24 100644 --- a/vignettes/getting-started-w-naniar.Rmd +++ b/vignettes/naniar.Rmd @@ -195,7 +195,7 @@ the function `replace_with_na`. This function is the compliment to - `tidyr::replace_na`: Missing values turns into a value (NA --> -99) - `naniar::replace_with_na`: Value becomes a missing value (-99 --> NA) -You can read more about this in the vignette ["Replacing values with NA"](http://naniar.njtierney.com/articles/replace-with-na.html) +You can read more about this in the vignette ["Replacing values with NA"](https://naniar.njtierney.com/articles/replace-with-na.html) # Tidy Missing Data: The Shadow Matrix diff --git a/vignettes/special-missing-values.Rmd b/vignettes/special-missing-values.Rmd index 5ae8fc47..b8bde01b 100644 --- a/vignettes/special-missing-values.Rmd +++ b/vignettes/special-missing-values.Rmd @@ -48,7 +48,7 @@ We create `nabular` data by `bind`ing the shadow to the data: bind_shadow(oceanbuoys) ``` -This keeps the data values tied to their missingness, and has great benefits for exploring missing and imputed values in data. See the vignettes [Getting Started with naniar](http://naniar.njtierney.com/articles/getting-started-w-naniar.html) and [Exploring Imputations with naniar](http://naniar.njtierney.com/articles/exploring-imputed-values.html) for more details. +This keeps the data values tied to their missingness, and has great benefits for exploring missing and imputed values in data. See the vignettes [Getting Started with naniar](https://naniar.njtierney.com/articles/naniar.html) and [Exploring Imputations with naniar](http://naniar.njtierney.com/articles/exploring-imputed-values.html) for more details. # Recoding missing values @@ -103,6 +103,6 @@ Under the hood, this special missing value is recoded as a new factor level in t Some examples of using `recode_shadow` in a workflow will be discussed in more detail in the near future, for the moment, here is a recommended workflow: * Use `recode_shadow()` with actual data -* Replacing the previous actual values using `replace_with_na()` (see the vignette on [replacing values with NA](http://naniar.njtierney.com/articles/replace-with-na.html)) +* Replacing the previous actual values using `replace_with_na()` (see the vignette on [replacing values with NA](https://naniar.njtierney.com/articles/replace-with-na.html)) * Explore missings where special cases are considered * Explore imputed values, looking at these special cases