├── .github ├── .gitignore └── workflows │ ├── R-CMD-check.yaml │ ├── test-coverage.yaml │ └── rhub.yaml ├── vignettes ├── .gitignore ├── visualization.Rmd └── categorical-data.Rmd ├── docs ├── CNAME ├── LICENSE ├── google02e424888b5e2def.html ├── hex_descriptr.png ├── reference │ ├── Rplot001.png │ ├── Rplot002.png │ ├── Rplot003.png │ ├── Rplot004.png │ ├── Rplot005.png │ ├── Rplot006.png │ ├── Rplot007.png │ ├── Rplot008.png │ ├── Rplot009.png │ ├── Rplot010.png │ ├── ds_plot_bar-1.png │ ├── ds_plot_bar-2.png │ ├── ds_plot_bar-3.png │ ├── ds_plot_bar-4.png │ ├── ds_screener-1.png │ ├── ds_cross_table-1.png │ ├── ds_cross_table-2.png │ ├── ds_cross_table-3.png │ ├── ds_freq_table-1.png │ ├── ds_freq_table-2.png │ ├── ds_freq_table-3.png │ ├── ds_freq_table-4.png │ ├── ds_plot_density-1.png │ ├── ds_plot_density-2.png │ ├── ds_plot_density-3.png │ ├── ds_plot_density-4.png │ ├── ds_plot_scatter-1.png │ ├── ds_plot_scatter-2.png │ ├── ds_plot_scatter-3.png │ ├── ds_plot_scatter-4.png │ ├── ds_plot_scatter-5.png │ ├── ds_plot_scatter-6.png │ ├── ds_plot_scatter-7.png │ ├── ds_plot_scatter-8.png │ ├── ds_plot_scatter-9.png │ ├── ds_group_summary-1.png │ ├── ds_plot_box_group-1.png │ ├── ds_plot_box_group-2.png │ ├── ds_plot_histogram-1.png │ ├── ds_plot_histogram-2.png │ ├── ds_plot_histogram-3.png │ ├── ds_plot_histogram-4.png │ ├── ds_plot_scatter-10.png │ ├── ds_plot_bar_grouped-1.png │ ├── ds_plot_bar_grouped-2.png │ ├── ds_plot_bar_grouped-3.png │ ├── ds_plot_bar_stacked-1.png │ ├── ds_plot_bar_stacked-2.png │ ├── ds_plot_bar_stacked-3.png │ ├── ds_plot_box_single-1.png │ ├── ds_plot_box_single-2.png │ ├── ds_plot_box_single-3.png │ ├── ds_plot_box_single-4.png │ ├── _PACKAGE.html │ ├── descriptr-package.html │ ├── ds_freq_cont.html │ ├── ds_multi_stats.html │ ├── plot.ds_screener.html │ ├── ds_twoway_table.html │ ├── plot.ds_freq_table.html │ ├── ds_oway_tables.html │ ├── ds_tway_tables.html │ ├── plot.ds_cross_table.html │ ├── ds_auto_cross_table.html │ └── plot.ds_group_summary.html ├── _headers ├── articles │ ├── visualization_files │ │ ├── figure-html │ │ │ ├── bar-1.png │ │ │ ├── bar-2.png │ │ │ ├── hist-1.png │ │ │ ├── hist-2.png │ │ │ ├── box_group-1.png │ │ │ ├── density-1.png │ │ │ ├── density-2.png │ │ │ ├── scatter-1.png │ │ │ ├── scatter-2.png │ │ │ ├── bar_grouped-1.png │ │ │ ├── bar_grouped-2.png │ │ │ ├── bar_stacked-1.png │ │ │ ├── bar_stacked-2.png │ │ │ ├── box_single-1.png │ │ │ └── box_single-2.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── categorical-data_files │ │ ├── figure-html │ │ │ ├── cross_group-1.png │ │ │ ├── cross_prop-1.png │ │ │ ├── cross_stack-1.png │ │ │ └── ftable_bar-1.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── continuous-data_files │ │ ├── figure-html │ │ │ ├── fcont_hist-1.png │ │ │ └── gsum_boxplot-1.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ └── index.html ├── deps │ ├── font-awesome-6.4.2 │ │ └── webfonts │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff2 │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-v4compatibility.ttf │ │ │ └── fa-v4compatibility.woff2 │ ├── headroom-0.11.0 │ │ ├── jQuery.headroom.min.js │ │ └── headroom.min.js │ ├── data-deps.txt │ └── bootstrap-toc-1.0.1 │ │ └── bootstrap-toc.min.js ├── pkgdown.yml ├── katex-auto.js ├── link.svg ├── bootstrap-toc.css ├── docsearch.js ├── docsearch.json ├── jquery.sticky-kit.min.js ├── lightswitch.js └── LICENSE-text.html ├── revdep ├── problems.md ├── .cache.rds ├── checks.rds ├── .gitignore ├── email.yml ├── cran.md ├── failures.md └── README.md ├── tests ├── figs │ ├── freq-table │ │ ├── ds-freq-bar.svg │ │ └── ds-freq-cont.svg │ ├── ds-cross-table │ │ ├── cross-bar.svg │ │ ├── cross-bar-stacked.svg │ │ └── cross-bar-proportional.svg │ ├── test-plots │ │ └── ds-screener-1.svg │ ├── ds-group-summary │ │ └── group-summary.svg │ └── deps.txt ├── testthat │ ├── _snaps │ │ ├── cross-table │ │ │ ├── cross-bar.svg │ │ │ ├── cross-bar-stacked.svg │ │ │ └── cross-bar-proportional.svg │ │ ├── freq-table │ │ │ ├── ds-freq-bar.svg │ │ │ └── ds-freq-cont.svg │ │ ├── group-summary │ │ │ └── group-summary.svg │ │ ├── cross-table.md │ │ └── plots │ │ │ ├── ds-plot-box-single-2.svg │ │ │ ├── ds-plot-box-single-4.svg │ │ │ ├── ds-plot-bar-1.svg │ │ │ └── ds-plot-bar-3.svg │ ├── Rplots.pdf │ ├── helper-utils.R │ ├── test-multistats.R │ ├── test-summary-stats.R │ ├── test-group-summary-interact.R │ ├── test-screen.R │ ├── test-group-summary.R │ ├── test-output.R │ ├── test-freq-table.R │ ├── test-auto-summary.R │ └── test-cross-table.R ├── README_files │ └── figure-gfm │ │ ├── tests-1.png │ │ ├── tests-2.png │ │ ├── tests-3.png │ │ ├── tests-4.png │ │ ├── tests-5.png │ │ ├── tests-6.png │ │ ├── tests-7.png │ │ ├── tests-8.png │ │ ├── tests-9.png │ │ ├── tests-10.png │ │ ├── tests-11.png │ │ ├── tests-12.png │ │ ├── tests-13.png │ │ ├── tests-14.png │ │ └── tests-15.png └── testthat.R ├── LICENSE ├── .gitattributes ├── .gitignore ├── data ├── hsb.rda └── mtcarz.rda ├── hex_descriptr.png ├── R ├── ds-data-mtcarz.R ├── ds-descriptr.R ├── ds-launch-shiny-app.R ├── ds-data-hsb.R ├── zzz.R ├── ds-freq-mult.R ├── ds-multistats.R ├── ds-cross-mult.R ├── ds-group-summary-interact.R ├── ds-freq-factor.R ├── ds-freq-numeric.R ├── ds-freq-table.R ├── ds-auto-summary.R ├── ds-summary-stats.R ├── ds-screener.R └── ds-mult-table.R ├── .Rbuildignore ├── codecov.yml ├── TODO.md ├── cran-comments.md ├── man ├── ds_std_error.Rd ├── mtcarz.Rd ├── ds_css.Rd ├── ds_cvar.Rd ├── ds_launch_shiny_app.Rd ├── ds_gmean.Rd ├── ds_hmean.Rd ├── ds_range.Rd ├── ds_auto_group_summary.Rd ├── ds_auto_summary_stats.Rd ├── ds_rindex.Rd ├── ds_mode.Rd ├── ds_plot_scatter.Rd ├── ds_kurtosis.Rd ├── ds_skewness.Rd ├── ds_tidy_stats.Rd ├── ds_extreme_obs.Rd ├── descriptr.Rd ├── ds_plot_box_single.Rd ├── ds_group_summary_interact.Rd ├── ds_plot_bar.Rd ├── ds_plot_bar_grouped.Rd ├── ds_plot_bar_stacked.Rd ├── ds_plot_box_group.Rd ├── ds_plot_density.Rd ├── ds_summary_stats.Rd ├── ds_mdev.Rd ├── ds_plot_histogram.Rd ├── ds_percentiles.Rd ├── hsb.Rd ├── ds_measures_symmetry.Rd ├── ds_measures_variation.Rd ├── ds_tailobs.Rd ├── ds_measures_location.Rd ├── ds_freq_table.Rd ├── ds_cross_table.Rd ├── ds_group_summary.Rd ├── ds_auto_freq_table.Rd └── ds_screener.Rd ├── descriptr.Rproj ├── DESCRIPTION ├── CONDUCT.md ├── NAMESPACE ├── README.Rmd └── _pkgdown.yml /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | descriptr.rsquaredacademy.com 2 | -------------------------------------------------------------------------------- /revdep/problems.md: -------------------------------------------------------------------------------- 1 | *Wow, no problems at all. :)* -------------------------------------------------------------------------------- /tests/figs/freq-table/ds-freq-bar.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/cross-table/cross-bar.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/freq-table/ds-freq-bar.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/figs/ds-cross-table/cross-bar.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/figs/freq-table/ds-freq-cont.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/figs/test-plots/ds-screener-1.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/freq-table/ds-freq-cont.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/group-summary/group-summary.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/figs/ds-cross-table/cross-bar-stacked.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/figs/ds-group-summary/group-summary.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/cross-table/cross-bar-stacked.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2016-18 2 | COPYRIGHT HOLDER: Aravind Hebbali 3 | -------------------------------------------------------------------------------- /tests/figs/ds-cross-table/cross-bar-proportional.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/cross-table/cross-bar-proportional.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2016 2 | COPYRIGHT HOLDER: Aravind Hebbali 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * linguist-vendored 2 | *.R linguist-vendored=false 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | inst/doc 6 | -------------------------------------------------------------------------------- /data/hsb.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/data/hsb.rda -------------------------------------------------------------------------------- /docs/google02e424888b5e2def.html: -------------------------------------------------------------------------------- 1 | google-site-verification: google02e424888b5e2def.html -------------------------------------------------------------------------------- /data/mtcarz.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/data/mtcarz.rda -------------------------------------------------------------------------------- /hex_descriptr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/hex_descriptr.png -------------------------------------------------------------------------------- /revdep/.cache.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/revdep/.cache.rds -------------------------------------------------------------------------------- /revdep/checks.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/revdep/checks.rds -------------------------------------------------------------------------------- /tests/figs/deps.txt: -------------------------------------------------------------------------------- 1 | - vdiffr-svg-engine: 1.0 2 | - vdiffr: 0.3.3 3 | - freetypeharfbuzz: 0.2.5 4 | -------------------------------------------------------------------------------- /docs/hex_descriptr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/hex_descriptr.png -------------------------------------------------------------------------------- /revdep/.gitignore: -------------------------------------------------------------------------------- 1 | checks 2 | library 3 | checks.noindex 4 | library.noindex 5 | data.sqlite 6 | *.html 7 | -------------------------------------------------------------------------------- /revdep/email.yml: -------------------------------------------------------------------------------- 1 | release_date: ??? 2 | rel_release_date: ??? 3 | my_news_url: ??? 4 | release_version: ??? 5 | -------------------------------------------------------------------------------- /tests/testthat/Rplots.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/testthat/Rplots.pdf -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/Rplot002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot002.png -------------------------------------------------------------------------------- /docs/reference/Rplot003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot003.png -------------------------------------------------------------------------------- /docs/reference/Rplot004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot004.png -------------------------------------------------------------------------------- /docs/reference/Rplot005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot005.png -------------------------------------------------------------------------------- /docs/reference/Rplot006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot006.png -------------------------------------------------------------------------------- /docs/reference/Rplot007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot007.png -------------------------------------------------------------------------------- /docs/reference/Rplot008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot008.png -------------------------------------------------------------------------------- /docs/reference/Rplot009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot009.png -------------------------------------------------------------------------------- /docs/reference/Rplot010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/Rplot010.png -------------------------------------------------------------------------------- /R/ds-data-mtcarz.R: -------------------------------------------------------------------------------- 1 | #' mtcarz 2 | #' 3 | #' Copy of mtcars data set with modified variable types 4 | #' 5 | "mtcarz" 6 | -------------------------------------------------------------------------------- /docs/_headers: -------------------------------------------------------------------------------- 1 | /* 2 | X-Frame-Options: DENY 3 | X-XSS-Protection: 1; mode=block 4 | X-Content-Type-Options: nosniff -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar-2.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar-3.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar-4.png -------------------------------------------------------------------------------- /docs/reference/ds_screener-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_screener-1.png -------------------------------------------------------------------------------- /docs/reference/ds_cross_table-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_cross_table-1.png -------------------------------------------------------------------------------- /docs/reference/ds_cross_table-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_cross_table-2.png -------------------------------------------------------------------------------- /docs/reference/ds_cross_table-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_cross_table-3.png -------------------------------------------------------------------------------- /docs/reference/ds_freq_table-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_freq_table-1.png -------------------------------------------------------------------------------- /docs/reference/ds_freq_table-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_freq_table-2.png -------------------------------------------------------------------------------- /docs/reference/ds_freq_table-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_freq_table-3.png -------------------------------------------------------------------------------- /docs/reference/ds_freq_table-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_freq_table-4.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_density-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_density-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_density-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_density-2.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_density-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_density-3.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_density-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_density-4.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-2.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-3.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-4.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-5.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-6.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-7.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-8.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-9.png -------------------------------------------------------------------------------- /docs/reference/ds_group_summary-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_group_summary-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_box_group-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_box_group-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_box_group-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_box_group-2.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_histogram-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_histogram-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_histogram-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_histogram-2.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_histogram-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_histogram-3.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_histogram-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_histogram-4.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_scatter-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_scatter-10.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar_grouped-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar_grouped-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar_grouped-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar_grouped-2.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar_grouped-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar_grouped-3.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar_stacked-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar_stacked-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar_stacked-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar_stacked-2.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_bar_stacked-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_bar_stacked-3.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_box_single-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_box_single-1.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_box_single-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_box_single-2.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_box_single-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_box_single-3.png -------------------------------------------------------------------------------- /docs/reference/ds_plot_box_single-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/reference/ds_plot_box_single-4.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-1.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-2.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-3.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-4.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-5.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-6.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-7.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-8.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-9.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-10.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-11.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-12.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-13.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-14.png -------------------------------------------------------------------------------- /tests/README_files/figure-gfm/tests-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/tests/README_files/figure-gfm/tests-15.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/bar-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/bar-1.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/bar-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/bar-2.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/hist-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/hist-1.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/hist-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/hist-2.png -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/box_group-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/box_group-1.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/density-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/density-1.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/density-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/density-2.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/scatter-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/scatter-1.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/scatter-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/scatter-2.png -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/bar_grouped-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/bar_grouped-1.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/bar_grouped-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/bar_grouped-2.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/bar_stacked-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/bar_stacked-1.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/bar_stacked-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/bar_stacked-2.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/box_single-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/box_single-1.png -------------------------------------------------------------------------------- /docs/articles/visualization_files/figure-html/box_single-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/visualization_files/figure-html/box_single-2.png -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /docs/articles/categorical-data_files/figure-html/cross_group-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/categorical-data_files/figure-html/cross_group-1.png -------------------------------------------------------------------------------- /docs/articles/categorical-data_files/figure-html/cross_prop-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/categorical-data_files/figure-html/cross_prop-1.png -------------------------------------------------------------------------------- /docs/articles/categorical-data_files/figure-html/cross_stack-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/categorical-data_files/figure-html/cross_stack-1.png -------------------------------------------------------------------------------- /docs/articles/categorical-data_files/figure-html/ftable_bar-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/categorical-data_files/figure-html/ftable_bar-1.png -------------------------------------------------------------------------------- /docs/articles/continuous-data_files/figure-html/fcont_hist-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/continuous-data_files/figure-html/fcont_hist-1.png -------------------------------------------------------------------------------- /docs/articles/continuous-data_files/figure-html/gsum_boxplot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsquaredacademy/descriptr/HEAD/docs/articles/continuous-data_files/figure-html/gsum_boxplot-1.png -------------------------------------------------------------------------------- /tests/testthat/helper-utils.R: -------------------------------------------------------------------------------- 1 | expect_doppelganger <- function(title, fig, path = NULL, ...) { 2 | testthat::skip_if_not_installed("vdiffr") 3 | vdiffr::expect_doppelganger(title, fig, path = path, ...) 4 | } 5 | -------------------------------------------------------------------------------- /docs/articles/categorical-data_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/continuous-data_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/visualization_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.travis\.yml$ 4 | ^appveyor\.yml$ 5 | ^cran-comments\.md$ 6 | ^README\.Rmd$ 7 | ^codecov\.yml$ 8 | ^NEWS$ 9 | ^_pkgdown\.yml$ 10 | ^docs$ 11 | ^README-.*\.png$ 12 | ^CONDUCT\.md$ 13 | ^revdep$ 14 | ^hex_descriptr\.png$ 15 | ^\.github$ 16 | TODO.md 17 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | informational: true 10 | patch: 11 | default: 12 | target: auto 13 | threshold: 1% 14 | informational: true 15 | -------------------------------------------------------------------------------- /docs/reference/_PACKAGE.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /revdep/cran.md: -------------------------------------------------------------------------------- 1 | ## revdepcheck results 2 | 3 | We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. 4 | 5 | * We saw 0 new problems 6 | * We failed to check 1 packages 7 | 8 | Issues with CRAN packages are summarised below. 9 | 10 | ### Failed to check 11 | 12 | * olsrr (NA) 13 | -------------------------------------------------------------------------------- /docs/reference/descriptr-package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/ds_freq_cont.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/ds_multi_stats.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/plot.ds_screener.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | ## TO DO 2 | 3 | #### Handle numeric data 4 | 5 | - ds_freq_table 6 | - ds_tidy_stats 7 | - ds_cross_table 8 | - ds_twoway_table 9 | - ds_plot_bar 10 | - ds_plot_bar 11 | - ds_plot_bar_grouped 12 | - ds_plot_bar_stacked 13 | - ds_plot_box_group 14 | - ds_plot_box_single 15 | - ds_plot_density 16 | - ds_plot_histogram 17 | - ds_plot_scatter 18 | -------------------------------------------------------------------------------- /docs/reference/ds_twoway_table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/plot.ds_freq_table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/ds_oway_tables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/ds_tway_tables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/plot.ds_cross_table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/ds_auto_cross_table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/plot.ds_group_summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: '3.2' 2 | pkgdown: 2.1.0 3 | pkgdown_sha: ~ 4 | articles: 5 | categorical-data: categorical-data.html 6 | continuous-data: continuous-data.html 7 | visualization: visualization.html 8 | last_built: 2024-11-08T09:46Z 9 | urls: 10 | reference: https://descriptr.rsquaredacademy.com/reference 11 | article: https://descriptr.rsquaredacademy.com/articles 12 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## R CMD check results 2 | 3 | 0 errors | 0 warnings | 0 note 4 | 5 | ## revdepcheck results 6 | 7 | We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. 8 | 9 | * We saw 0 new problems 10 | * We failed to check 1 packages 11 | 12 | Issues with CRAN packages are summarised below. 13 | 14 | ### Failed to check 15 | 16 | * olsrr (NA) 17 | -------------------------------------------------------------------------------- /man/ds_std_error.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-utils.R 3 | \name{ds_std_error} 4 | \alias{ds_std_error} 5 | \title{Standard error of mean} 6 | \usage{ 7 | ds_std_error(x) 8 | } 9 | \arguments{ 10 | \item{x}{A numeric vector.} 11 | } 12 | \description{ 13 | Returns the standard error of mean. 14 | } 15 | \examples{ 16 | ds_std_error(mtcars$mpg) 17 | 18 | } 19 | -------------------------------------------------------------------------------- /man/mtcarz.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-data-mtcarz.R 3 | \docType{data} 4 | \name{mtcarz} 5 | \alias{mtcarz} 6 | \title{mtcarz} 7 | \format{ 8 | An object of class \code{data.frame} with 32 rows and 11 columns. 9 | } 10 | \usage{ 11 | mtcarz 12 | } 13 | \description{ 14 | Copy of mtcars data set with modified variable types 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /revdep/failures.md: -------------------------------------------------------------------------------- 1 | # olsrr 2 | 3 |
4 | 5 | * Version: 0.6.1 6 | * GitHub: https://github.com/rsquaredacademy/olsrr 7 | * Source code: https://github.com/cran/olsrr 8 | * Date/Publication: 2024-11-06 12:50:06 UTC 9 | * Number of recursive dependencies: 116 10 | 11 | Run `revdepcheck::revdep_details(, "olsrr")` for more info 12 | 13 |
14 | 15 | ## In both 16 | 17 | * R CMD check timed out 18 | 19 | 20 | -------------------------------------------------------------------------------- /descriptr.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | # This file is part of the standard setup for testthat. 2 | # It is recommended that you do not modify it. 3 | # 4 | # Where should you do additional test configuration? 5 | # Learn more about the roles of various files in: 6 | # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview 7 | # * https://testthat.r-lib.org/articles/special-files.html 8 | 9 | library(testthat) 10 | library(descriptr) 11 | 12 | test_check("descriptr") 13 | -------------------------------------------------------------------------------- /man/ds_css.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_css} 4 | \alias{ds_css} 5 | \title{Corrected Sum of Squares} 6 | \usage{ 7 | ds_css(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \description{ 15 | Compute the corrected sum of squares 16 | } 17 | \examples{ 18 | # vector 19 | ds_css(mtcars$mpg) 20 | 21 | # data.frame 22 | ds_css(mtcars, mpg) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ds_cvar.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_cvar} 4 | \alias{ds_cvar} 5 | \title{Coefficient of Variation} 6 | \usage{ 7 | ds_cvar(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \description{ 15 | Compute the coefficient of variation 16 | } 17 | \examples{ 18 | # vector 19 | ds_cvar(mtcars$mpg) 20 | 21 | # data.frame 22 | ds_cvar(mtcars, mpg) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ds_launch_shiny_app.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-launch-shiny-app.R 3 | \name{ds_launch_shiny_app} 4 | \alias{ds_launch_shiny_app} 5 | \title{Launch Shiny App} 6 | \usage{ 7 | ds_launch_shiny_app() 8 | } 9 | \description{ 10 | Launches shiny app 11 | } 12 | \section{Deprecated Function}{ 13 | 14 | \code{launch_descriptr()} has been deprecated. Instead 15 | use \code{ds_launch_shiny_app()}. 16 | } 17 | 18 | \examples{ 19 | \dontrun{ 20 | ds_launch_shiny_app() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /man/ds_gmean.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_gmean} 4 | \alias{ds_gmean} 5 | \title{Geometric Mean} 6 | \usage{ 7 | ds_gmean(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \description{ 15 | Computes the geometric mean 16 | } 17 | \examples{ 18 | # vector 19 | ds_gmean(mtcars$mpg) 20 | 21 | # data.frame 22 | ds_gmean(mtcars, mpg) 23 | 24 | } 25 | \seealso{ 26 | \code{\link{ds_hmean}} \code{\link[base]{mean}} 27 | } 28 | -------------------------------------------------------------------------------- /man/ds_hmean.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_hmean} 4 | \alias{ds_hmean} 5 | \title{Harmonic Mean} 6 | \usage{ 7 | ds_hmean(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \description{ 15 | Computes the harmonic mean 16 | } 17 | \examples{ 18 | # vector 19 | ds_hmean(mtcars$mpg) 20 | 21 | # data.frame 22 | ds_hmean(mtcars, mpg) 23 | 24 | } 25 | \seealso{ 26 | \code{\link{ds_gmean}} \code{\link[base]{mean}} 27 | } 28 | -------------------------------------------------------------------------------- /man/ds_range.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_range} 4 | \alias{ds_range} 5 | \title{Range} 6 | \usage{ 7 | ds_range(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \value{ 15 | Range of \code{x} 16 | } 17 | \description{ 18 | Compute the range of a numeric vector 19 | } 20 | \examples{ 21 | # vector 22 | ds_range(mtcars$mpg) 23 | 24 | # data.frame 25 | ds_range(mtcars, mpg) 26 | 27 | } 28 | \seealso{ 29 | \code{\link[base]{range}} 30 | } 31 | -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/jQuery.headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.9.4 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(a){a&&(a.fn.headroom=function(b){return this.each(function(){var c=a(this),d=c.data("headroom"),e="object"==typeof b&&b;e=a.extend(!0,{},Headroom.options,e),d||(d=new Headroom(this,e),d.init(),c.data("headroom",d)),"string"==typeof b&&(d[b](),"destroy"===b&&c.removeData("headroom"))})},a("[data-headroom]").each(function(){var b=a(this);b.headroom(b.data())}))}(window.Zepto||window.jQuery); -------------------------------------------------------------------------------- /man/ds_auto_group_summary.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-auto-summary.R 3 | \name{ds_auto_group_summary} 4 | \alias{ds_auto_group_summary} 5 | \title{Tabulation} 6 | \usage{ 7 | ds_auto_group_summary(data, ...) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | } 14 | \description{ 15 | Generate summary statistics for all continuous variables in data. 16 | } 17 | \examples{ 18 | # summary statistics of mpg & disp for each level of cyl & gear 19 | ds_auto_group_summary(mtcarz, cyl, gear, mpg, disp) 20 | 21 | } 22 | -------------------------------------------------------------------------------- /docs/katex-auto.js: -------------------------------------------------------------------------------- 1 | // https://github.com/jgm/pandoc/blob/29fa97ab96b8e2d62d48326e1b949a71dc41f47a/src/Text/Pandoc/Writers/HTML.hs#L332-L345 2 | document.addEventListener("DOMContentLoaded", function () { 3 | var mathElements = document.getElementsByClassName("math"); 4 | var macros = []; 5 | for (var i = 0; i < mathElements.length; i++) { 6 | var texText = mathElements[i].firstChild; 7 | if (mathElements[i].tagName == "SPAN") { 8 | katex.render(texText.data, mathElements[i], { 9 | displayMode: mathElements[i].classList.contains("display"), 10 | throwOnError: false, 11 | macros: macros, 12 | fleqn: false 13 | }); 14 | }}}); 15 | -------------------------------------------------------------------------------- /man/ds_auto_summary_stats.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-auto-summary.R 3 | \name{ds_auto_summary_stats} 4 | \alias{ds_auto_summary_stats} 5 | \title{Descriptive statistics and frquency tables} 6 | \usage{ 7 | ds_auto_summary_stats(data, ...) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | } 14 | \description{ 15 | Generate summary statistics & frequency table for all continuous variables in data. 16 | } 17 | \examples{ 18 | # all columns 19 | ds_auto_summary_stats(mtcarz) 20 | 21 | # multiple columns 22 | ds_auto_summary_stats(mtcarz, disp, hp) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ds_rindex.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_rindex} 4 | \alias{ds_rindex} 5 | \title{Index Values} 6 | \usage{ 7 | ds_rindex(data, values) 8 | } 9 | \arguments{ 10 | \item{data}{a numeric vector} 11 | 12 | \item{values}{a numeric vector containing the values whose index is returned} 13 | } 14 | \value{ 15 | Index of the \code{values} in \code{data}. In case, \code{data} does 16 | not contain \code{index}, \code{NULL} is returned. 17 | } 18 | \description{ 19 | Returns index of values. 20 | } 21 | \examples{ 22 | # returns index of 21 23 | ds_rindex(mtcars$mpg, 21) 24 | 25 | # returns NULL 26 | ds_rindex(mtcars$mpg, 22) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /man/ds_mode.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_mode} 4 | \alias{ds_mode} 5 | \title{Mode} 6 | \usage{ 7 | ds_mode(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \value{ 15 | Mode of \code{x} 16 | } 17 | \description{ 18 | Compute the sample mode 19 | } 20 | \details{ 21 | Any NA values are stripped from \code{x} before computation 22 | takes place. 23 | } 24 | \examples{ 25 | # vector 26 | ds_mode(mtcars$mpg) 27 | 28 | # data.frame 29 | ds_mode(mtcars, mpg) 30 | 31 | } 32 | \seealso{ 33 | \code{\link[base]{mean}} \code{\link[stats]{median}} 34 | } 35 | -------------------------------------------------------------------------------- /man/ds_plot_scatter.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-plots.R 3 | \name{ds_plot_scatter} 4 | \alias{ds_plot_scatter} 5 | \title{Generate scatter plots} 6 | \usage{ 7 | ds_plot_scatter(data, ..., print_plot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 15 | } 16 | \description{ 17 | Creates scatter plots if the data has continuous variables. 18 | } 19 | \examples{ 20 | # plot select variables 21 | ds_plot_scatter(mtcarz, mpg, disp) 22 | 23 | # plot all variables 24 | ds_plot_scatter(mtcarz) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /R/ds-descriptr.R: -------------------------------------------------------------------------------- 1 | #' \code{descriptr} package 2 | #' 3 | #' Generate descriptive statistics and explore statistical distributions 4 | #' 5 | #' @import stats 6 | #' @import ggplot2 7 | #' @import magrittr 8 | #' 9 | #' @docType package 10 | #' @keywords internal 11 | #' @name descriptr 12 | #' @aliases descriptr-package 13 | "_PACKAGE" 14 | 15 | ## quiets concerns of R CMD check re: the .'s that appear in pipelines 16 | if (getRversion() >= "2.15.1") { 17 | globalVariables(c( 18 | ".", "breaks", "Levels", "varyable", "count", 19 | "cumulative", "frequency", "values", "s", "tp", "type", "xvar", "yvar", 20 | "data", "varnames", "frequency", "varname", "bins", "n", "value", "y", 21 | "count", "plot_data", "utility" 22 | )) 23 | } 24 | -------------------------------------------------------------------------------- /R/ds-launch-shiny-app.R: -------------------------------------------------------------------------------- 1 | #' @title Launch Shiny App 2 | #' @description Launches shiny app 3 | #' @section Deprecated Function: 4 | #' \code{launch_descriptr()} has been deprecated. Instead 5 | #' use \code{ds_launch_shiny_app()}. 6 | #' @examples 7 | #' \dontrun{ 8 | #' ds_launch_shiny_app() 9 | #' } 10 | #' @export 11 | #' 12 | ds_launch_shiny_app <- function() { 13 | 14 | check_suggests('xplorerr') 15 | check_suggests('haven') 16 | check_suggests('jsonlite') 17 | check_suggests('readr') 18 | check_suggests('readxl') 19 | check_suggests('shinyBS') 20 | check_suggests('shinycssloaders') 21 | check_suggests('shinythemes') 22 | check_suggests('stringr') 23 | check_suggests('lubridate') 24 | 25 | xplorerr::app_descriptive() 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/testthat/test-multistats.R: -------------------------------------------------------------------------------- 1 | fdata <- dplyr::select(mtcarz, cyl, gear, am, vs) 2 | ndata <- dplyr::select(mtcarz, mpg, disp, hp, wt, qsec, drat) 3 | 4 | test_that("multistats throws appropriate error", { 5 | expect_error(ds_tidy_stats(fdata), "Data has no continuous variables.") 6 | }) 7 | 8 | test_that("output from multistats is as expected", { 9 | 10 | actual <- 11 | ds_tidy_stats(mtcars, mpg, disp, hp) %>% 12 | dplyr::filter(vars == "disp") %>% 13 | dplyr::select(min) %>% 14 | as.data.frame() 15 | expected <- data.frame(min = 71.1) 16 | 17 | expect_equal(actual, expected) 18 | 19 | k <- ds_tidy_stats(ndata) 20 | actual <- round(k$min[1], 2) 21 | expected <- 71.1 22 | 23 | expect_equal(actual, expected) 24 | 25 | }) 26 | -------------------------------------------------------------------------------- /man/ds_kurtosis.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_kurtosis} 4 | \alias{ds_kurtosis} 5 | \title{Kurtosis} 6 | \usage{ 7 | ds_kurtosis(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \description{ 15 | Compute the kurtosis of a probability distribution. 16 | } 17 | \examples{ 18 | # vector 19 | ds_kurtosis(mtcars$mpg) 20 | 21 | # data.frame 22 | ds_kurtosis(mtcars, mpg) 23 | 24 | } 25 | \references{ 26 | Sheskin, D.J. (2000) Handbook of Parametric and Nonparametric Statistical Procedures, Second Edition. Boca Raton, Florida: Chapman & Hall/CRC. 27 | } 28 | \seealso{ 29 | \code{ds_skewness} 30 | } 31 | -------------------------------------------------------------------------------- /man/ds_skewness.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_skewness} 4 | \alias{ds_skewness} 5 | \title{Skewness} 6 | \usage{ 7 | ds_skewness(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \description{ 15 | Compute the skewness of a probability distribution. 16 | } 17 | \examples{ 18 | # vector 19 | ds_skewness(mtcars$mpg) 20 | 21 | # data.frame 22 | ds_skewness(mtcars, mpg) 23 | 24 | } 25 | \references{ 26 | Sheskin, D.J. (2000) Handbook of Parametric and Nonparametric Statistical Procedures, Second Edition. Boca Raton, Florida: Chapman & Hall/CRC. 27 | } 28 | \seealso{ 29 | \code{kurtosis} 30 | } 31 | -------------------------------------------------------------------------------- /docs/articles/continuous-data_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/visualization_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/categorical-data_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /man/ds_tidy_stats.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-multistats.R 3 | \name{ds_tidy_stats} 4 | \alias{ds_tidy_stats} 5 | \alias{ds_multi_stats} 6 | \title{Tidy descriptive statistics} 7 | \usage{ 8 | ds_tidy_stats(data, ...) 9 | } 10 | \arguments{ 11 | \item{data}{A \code{tibble} or a \code{data.frame}.} 12 | 13 | \item{...}{Columns in \code{x}.} 14 | } 15 | \value{ 16 | A tibble. 17 | } 18 | \description{ 19 | Descriptive statistics for multiple variables. 20 | } 21 | \section{Deprecated Functions}{ 22 | 23 | \code{ds_multi_stats()} have been deprecated. Instead use \code{ds_tidy_stats()}. 24 | } 25 | 26 | \examples{ 27 | # all columns 28 | ds_tidy_stats(mtcarz) 29 | 30 | # multiple columns 31 | ds_tidy_stats(mtcarz, mpg, disp, hp) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/ds_extreme_obs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_extreme_obs} 4 | \alias{ds_extreme_obs} 5 | \title{Extreme observations} 6 | \usage{ 7 | ds_extreme_obs(data, col, decimals = 2) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame} or \code{tibble}.} 11 | 12 | \item{col}{Column in \code{data}.} 13 | 14 | \item{decimals}{An option to specify the exact number of decimal places to use. The default number of decimal places is 2.} 15 | } 16 | \description{ 17 | Returns the most extreme observations. 18 | } 19 | \examples{ 20 | # data.frame 21 | ds_extreme_obs(mtcarz, mpg) 22 | 23 | # vector 24 | ds_extreme_obs(mtcarz$mpg) 25 | 26 | # decimal places 27 | ds_extreme_obs(mtcarz$mpg, decimals = 3) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/descriptr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-descriptr.R 3 | \docType{package} 4 | \name{descriptr} 5 | \alias{descriptr} 6 | \alias{_PACKAGE} 7 | \alias{descriptr-package} 8 | \title{\code{descriptr} package} 9 | \description{ 10 | Generate descriptive statistics and explore statistical distributions 11 | } 12 | \seealso{ 13 | Useful links: 14 | \itemize{ 15 | \item \url{https://descriptr.rsquaredacademy.com/} 16 | \item \url{https://github.com/rsquaredacademy/descriptr} 17 | \item Report bugs at \url{https://github.com/rsquaredacademy/descriptr/issues} 18 | } 19 | 20 | } 21 | \author{ 22 | \strong{Maintainer}: Aravind Hebbali \email{hebbali.aravind@gmail.com} (\href{https://orcid.org/0000-0001-9220-9669}{ORCID}) 23 | 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/ds_plot_box_single.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-plots.R 3 | \name{ds_plot_box_single} 4 | \alias{ds_plot_box_single} 5 | \title{Generate box plots} 6 | \usage{ 7 | ds_plot_box_single(data, ..., print_plot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 15 | } 16 | \description{ 17 | Creates box plots if the data has continuous variables. 18 | } 19 | \examples{ 20 | # plot single variable 21 | ds_plot_box_single(mtcarz, mpg) 22 | 23 | # plot multiple variables 24 | ds_plot_box_single(mtcarz, mpg, disp, hp) 25 | 26 | # plot all variables 27 | ds_plot_box_single(mtcarz) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /tests/testthat/test-summary-stats.R: -------------------------------------------------------------------------------- 1 | ndata <- dplyr::select(mtcarz, mpg) 2 | 3 | test_that("output from ds_summary is as expected when data is a data.frame", { 4 | 5 | actual <- round(ds_summary(mtcarz, mpg)$variance, 2) 6 | expected <- 36.32 7 | expect_equal(actual, expected) 8 | 9 | }) 10 | 11 | test_that("output from ds_summary is as expected when data is numeric", { 12 | 13 | actual <- round(ds_summary(mtcarz$mpg)$variance, 2) 14 | expected <- 36.32 15 | expect_equal(actual, expected) 16 | 17 | }) 18 | 19 | test_that("ds_summary_stats throws appropriate errors", { 20 | fdata <- dplyr::select(mtcarz, cyl, gear, am, vs) 21 | expect_error(ds_summary_stats(fdata), 'Data has no continuous variables.') 22 | expect_error(ds_summary_stats(mtcarz, cyl, gear), 'Data has no continuous variables.') 23 | }) 24 | -------------------------------------------------------------------------------- /man/ds_group_summary_interact.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-group-summary-interact.R 3 | \name{ds_group_summary_interact} 4 | \alias{ds_group_summary_interact} 5 | \title{Category wise descriptive statistics} 6 | \usage{ 7 | ds_group_summary_interact(data, col, ...) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or a \code{tibble}.} 11 | 12 | \item{col}{Column in \code{data}; continuous variable.} 13 | 14 | \item{...}{Columns in \code{data}; categorical variables.} 15 | } 16 | \description{ 17 | Descriptive statistics of a continuous variable for the combination of levels 18 | of two or more categorical variables. 19 | } 20 | \examples{ 21 | ds_group_summary_interact(mtcarz, mpg, cyl, gear) 22 | 23 | } 24 | \seealso{ 25 | \code{\link{ds_group_summary}} 26 | } 27 | -------------------------------------------------------------------------------- /man/ds_plot_bar.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-plots.R 3 | \name{ds_plot_bar} 4 | \alias{ds_plot_bar} 5 | \title{Generate bar plots} 6 | \usage{ 7 | ds_plot_bar(data, ..., fill = "blue", print_plot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{fill}{Color of the bars.} 15 | 16 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 17 | } 18 | \description{ 19 | Creates bar plots if the data has categorical variables. 20 | } 21 | \examples{ 22 | # plot single variable 23 | ds_plot_bar(mtcarz, cyl) 24 | 25 | # plot multiple variables 26 | ds_plot_bar(mtcarz, cyl, gear) 27 | 28 | # plot all variables 29 | ds_plot_bar(mtcarz) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/ds_plot_bar_grouped.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-plots.R 3 | \name{ds_plot_bar_grouped} 4 | \alias{ds_plot_bar_grouped} 5 | \title{Generate grouped bar plots} 6 | \usage{ 7 | ds_plot_bar_grouped(data, ..., print_plot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 15 | } 16 | \description{ 17 | Creates grouped bar plots if the data has categorical variables. 18 | } 19 | \examples{ 20 | # subset data 21 | mt <- dplyr::select(mtcarz, cyl, gear, am) 22 | 23 | # grouped bar plot 24 | ds_plot_bar_grouped(mtcarz, cyl, gear) 25 | 26 | # plot all variables 27 | ds_plot_bar_grouped(mt) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/ds_plot_bar_stacked.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-plots.R 3 | \name{ds_plot_bar_stacked} 4 | \alias{ds_plot_bar_stacked} 5 | \title{Generate stacked bar plots} 6 | \usage{ 7 | ds_plot_bar_stacked(data, ..., print_plot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 15 | } 16 | \description{ 17 | Creates stacked bar plots if the data has categorical variables. 18 | } 19 | \examples{ 20 | # subset data 21 | mt <- dplyr::select(mtcarz, cyl, gear, am) 22 | 23 | # stacked bar plot 24 | ds_plot_bar_stacked(mtcarz, cyl, gear) 25 | 26 | # plot all variables 27 | ds_plot_bar_stacked(mt) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/ds_plot_box_group.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-plots.R 3 | \name{ds_plot_box_group} 4 | \alias{ds_plot_box_group} 5 | \title{Compare distributions} 6 | \usage{ 7 | ds_plot_box_group(data, ..., print_plot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 15 | } 16 | \description{ 17 | Creates box plots if the data has both categorical & continuous variables. 18 | } 19 | \examples{ 20 | # subset data 21 | mt <- dplyr::select(mtcarz, cyl, disp, mpg) 22 | 23 | # plot select variables 24 | ds_plot_box_group(mtcarz, cyl, gear, mpg) 25 | 26 | # plot all variables 27 | ds_plot_box_group(mt) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /R/ds-data-hsb.R: -------------------------------------------------------------------------------- 1 | #' High School and Beyond Data Set 2 | #' 3 | #' A dataset containing demographic information and standardized test 4 | #' scores of high school students. 5 | #' 6 | #' @format A data frame with 200 rows and 10 variables: 7 | #' \describe{ 8 | #' \item{id}{id of the student} 9 | #' \item{female}{gender of the student} 10 | #' \item{race}{ethnic background of the student} 11 | #' \item{ses}{socio-economic status of the student} 12 | #' \item{schtyp}{school type} 13 | #' \item{prog}{program type} 14 | #' \item{read}{scores from test of reading} 15 | #' \item{write}{scores from test of writing} 16 | #' \item{math}{scores from test of math} 17 | #' \item{science}{scores from test of science} 18 | #' \item{socst}{scores from test of social studies} 19 | #' } 20 | #' 21 | #' @source \url{https://nces.ed.gov/surveys/hsb/} 22 | #' 23 | "hsb" 24 | -------------------------------------------------------------------------------- /man/ds_plot_density.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-plots.R 3 | \name{ds_plot_density} 4 | \alias{ds_plot_density} 5 | \title{Generate density plots} 6 | \usage{ 7 | ds_plot_density(data, ..., color = "blue", print_plot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{color}{Color of the plot.} 15 | 16 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 17 | } 18 | \description{ 19 | Creates density plots if the data has continuous variables. 20 | } 21 | \examples{ 22 | # plot single variable 23 | ds_plot_density(mtcarz, mpg) 24 | 25 | # plot multiple variables 26 | ds_plot_density(mtcarz, mpg, disp, hp) 27 | 28 | # plot all variables 29 | ds_plot_density(mtcarz) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/ds_summary_stats.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-summary-stats.R 3 | \name{ds_summary_stats} 4 | \alias{ds_summary_stats} 5 | \title{Descriptive statistics} 6 | \usage{ 7 | ds_summary_stats(data, ...) 8 | } 9 | \arguments{ 10 | \item{data}{An object of type \code{numeric} or \code{data.frame}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | } 14 | \description{ 15 | Range of descriptive statistics for continuous data. 16 | } 17 | \examples{ 18 | # numeric data 19 | ds_summary_stats(mtcarz$mpg) 20 | 21 | # single variable 22 | ds_summary_stats(mtcarz, mpg) 23 | 24 | # multiple variables 25 | ds_summary_stats(mtcarz, mpg, disp, hp) 26 | 27 | # all variables 28 | ds_summary_stats(mtcarz) 29 | 30 | } 31 | \seealso{ 32 | \code{\link[base]{summary}} 33 | \code{\link{ds_freq_table}} \code{\link{ds_cross_table}} 34 | } 35 | -------------------------------------------------------------------------------- /man/ds_mdev.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_mdev} 4 | \alias{ds_mdev} 5 | \title{Mean Absolute Deviation} 6 | \usage{ 7 | ds_mdev(data, x = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A numeric vector or \code{data.frame}.} 11 | 12 | \item{x}{Column in \code{data}.} 13 | } 14 | \description{ 15 | Compute the mean absolute deviation about the mean 16 | } 17 | \details{ 18 | The \code{ds_mdev} function computes the mean absolute deviation 19 | about the mean. It is different from \code{mad} in \code{stats} package as 20 | the statistic used to compute the deviations is not \code{median} but 21 | \code{mean}. Any NA values are stripped from \code{x} before computation 22 | takes place 23 | } 24 | \examples{ 25 | # vector 26 | ds_mdev(mtcars$mpg) 27 | 28 | # data.frame 29 | ds_mdev(mtcars, mpg) 30 | 31 | } 32 | \seealso{ 33 | \code{\link[stats]{mad}} 34 | } 35 | -------------------------------------------------------------------------------- /tests/testthat/test-group-summary-interact.R: -------------------------------------------------------------------------------- 1 | test_that("output from ds_group_summary_interact is as expected", { 2 | actual <- 3 | ds_group_summary_interact(mtcarz, mpg, cyl, gear) %>% 4 | dplyr::select(min) %>% 5 | sum() %>% 6 | round(2) 7 | expect_equal(actual, 149.9) 8 | }) 9 | 10 | test_that("ds_group_summary_interact throws the appropriate error", { 11 | 12 | expect_error( 13 | ds_group_summary_interact(mtcarz, am, cyl, gear), 14 | "am is not a continuous variable. The function expects an object of type `numeric` or `integer` but am is of type `factor`." 15 | ) 16 | 17 | expect_error( 18 | ds_group_summary_interact(mtcarz, mpg, cyl, disp, hp), 19 | "Below grouping variables are not categorical: 20 | - disp 21 | - hp" 22 | ) 23 | 24 | expect_error( 25 | ds_group_summary_interact(mtcarz, mpg, cyl, hp), 26 | "Below grouping variables are not categorical: 27 | - hp" 28 | ) 29 | }) 30 | -------------------------------------------------------------------------------- /docs/deps/data-deps.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /man/ds_plot_histogram.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-plots.R 3 | \name{ds_plot_histogram} 4 | \alias{ds_plot_histogram} 5 | \title{Generate histograms} 6 | \usage{ 7 | ds_plot_histogram(data, ..., bins = 5, fill = "blue", print_plot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{bins}{Number of bins in the histogram.} 15 | 16 | \item{fill}{Color of the histogram.} 17 | 18 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 19 | } 20 | \description{ 21 | Creates histograms if the data has continuous variables. 22 | } 23 | \examples{ 24 | # plot single variable 25 | ds_plot_histogram(mtcarz, mpg) 26 | 27 | # plot multiple variables 28 | ds_plot_histogram(mtcarz, mpg, disp, hp) 29 | 30 | # plot all variables 31 | ds_plot_histogram(mtcarz) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/ds_percentiles.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_percentiles} 4 | \alias{ds_percentiles} 5 | \title{Percentiles} 6 | \usage{ 7 | ds_percentiles(data, ..., decimals = 2) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{decimals}{An option to specify the exact number of decimal places to use. The default number of decimal places is 2.} 15 | } 16 | \description{ 17 | Returns the percentiles 18 | } 19 | \examples{ 20 | # single column 21 | ds_percentiles(mtcarz, mpg) 22 | 23 | # multiple columns 24 | ds_percentiles(mtcarz, mpg, disp) 25 | 26 | # all columns 27 | ds_percentiles(mtcarz) 28 | 29 | # vector 30 | ds_percentiles(mtcarz$mpg) 31 | 32 | # vectors of different length 33 | disp <- mtcarz$disp[1:10] 34 | ds_percentiles(mtcarz$mpg, disp) 35 | 36 | # decimal places 37 | ds_percentiles(mtcarz, disp, hp, decimals = 3) 38 | 39 | } 40 | -------------------------------------------------------------------------------- /man/hsb.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-data-hsb.R 3 | \docType{data} 4 | \name{hsb} 5 | \alias{hsb} 6 | \title{High School and Beyond Data Set} 7 | \format{ 8 | A data frame with 200 rows and 10 variables: 9 | \describe{ 10 | \item{id}{id of the student} 11 | \item{female}{gender of the student} 12 | \item{race}{ethnic background of the student} 13 | \item{ses}{socio-economic status of the student} 14 | \item{schtyp}{school type} 15 | \item{prog}{program type} 16 | \item{read}{scores from test of reading} 17 | \item{write}{scores from test of writing} 18 | \item{math}{scores from test of math} 19 | \item{science}{scores from test of science} 20 | \item{socst}{scores from test of social studies} 21 | } 22 | } 23 | \source{ 24 | \url{https://nces.ed.gov/surveys/hsb/} 25 | } 26 | \usage{ 27 | hsb 28 | } 29 | \description{ 30 | A dataset containing demographic information and standardized test 31 | scores of high school students. 32 | } 33 | \keyword{datasets} 34 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: descriptr 2 | Type: Package 3 | Title: Generate Descriptive Statistics 4 | Version: 0.6.0.9000 5 | Authors@R: person("Aravind", "Hebbali", email = "hebbali.aravind@gmail.com", role = c("aut", "cre"), 6 | comment = c(ORCID = "0000-0001-9220-9669")) 7 | Description: Generate descriptive statistics such as measures of location, 8 | dispersion, frequency tables, cross tables, group summaries and multiple 9 | one/two way tables. 10 | Depends: 11 | R(>= 3.3.0) 12 | Imports: 13 | dplyr, 14 | ggplot2, 15 | magrittr, 16 | rlang, 17 | scales, 18 | stats, 19 | tidyr, 20 | utils 21 | Suggests: 22 | covr, 23 | gridExtra, 24 | knitr, 25 | rmarkdown, 26 | testthat (>= 3.0.0), 27 | vdiffr, 28 | xplorerr 29 | License: MIT + file LICENSE 30 | URL: https://descriptr.rsquaredacademy.com/, https://github.com/rsquaredacademy/descriptr 31 | BugReports: https://github.com/rsquaredacademy/descriptr/issues 32 | Encoding: UTF-8 33 | LazyData: true 34 | VignetteBuilder: knitr 35 | RoxygenNote: 7.2.3 36 | Config/testthat/edition: 3 37 | -------------------------------------------------------------------------------- /man/ds_measures_symmetry.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_measures_symmetry} 4 | \alias{ds_measures_symmetry} 5 | \title{Measures of symmetry} 6 | \usage{ 7 | ds_measures_symmetry(data, ..., decimals = 2) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{decimals}{An option to specify the exact number of decimal places to use. The default number of decimal places is 2.} 15 | } 16 | \description{ 17 | Returns the measures of symmetry such as skewness and kurtosis. 18 | } 19 | \examples{ 20 | # single column 21 | ds_measures_symmetry(mtcarz, mpg) 22 | 23 | # multiple columns 24 | ds_measures_symmetry(mtcarz, mpg, disp) 25 | 26 | # all columns 27 | ds_measures_symmetry(mtcarz) 28 | 29 | # vector 30 | ds_measures_symmetry(mtcarz$mpg) 31 | 32 | # vectors of different length 33 | disp <- mtcarz$disp[1:10] 34 | ds_measures_symmetry(mtcarz$mpg, disp) 35 | 36 | # decimal places 37 | ds_measures_symmetry(mtcarz, disp, hp, decimals = 3) 38 | 39 | } 40 | -------------------------------------------------------------------------------- /man/ds_measures_variation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_measures_variation} 4 | \alias{ds_measures_variation} 5 | \title{Measures of variation} 6 | \usage{ 7 | ds_measures_variation(data, ..., decimals = 2) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble}.} 11 | 12 | \item{...}{Column(s) in \code{data}.} 13 | 14 | \item{decimals}{An option to specify the exact number of decimal places to use. The default number of decimal places is 2.} 15 | } 16 | \description{ 17 | Returns the measures of location such as range, variance and standard 18 | deviation. 19 | } 20 | \examples{ 21 | # single column 22 | ds_measures_variation(mtcarz, mpg) 23 | 24 | # multiple columns 25 | ds_measures_variation(mtcarz, mpg, disp) 26 | 27 | # all columns 28 | ds_measures_variation(mtcarz) 29 | 30 | # vector 31 | ds_measures_variation(mtcarz$mpg) 32 | 33 | # vectors of different length 34 | disp <- mtcarz$disp[1:10] 35 | ds_measures_variation(mtcarz$mpg, disp) 36 | 37 | # decimal places 38 | ds_measures_variation(mtcarz, disp, hp, decimals = 3) 39 | 40 | } 41 | -------------------------------------------------------------------------------- /docs/articles/visualization_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/categorical-data_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/continuous-data_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /man/ds_tailobs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_tailobs} 4 | \alias{ds_tailobs} 5 | \title{Tail Observations} 6 | \usage{ 7 | ds_tailobs(data, n, type = c("low", "high"), decimals = 2) 8 | } 9 | \arguments{ 10 | \item{data}{a numeric vector} 11 | 12 | \item{n}{number of observations to be returned} 13 | 14 | \item{type}{if \code{low}, the \code{n} lowest observations are returned, else the highest \code{n} observations are returned.} 15 | 16 | \item{decimals}{An option to specify the exact number of decimal places to use. The default number of decimal places is 2.} 17 | } 18 | \value{ 19 | \code{n} highest/lowest observations from \code{data} 20 | } 21 | \description{ 22 | Returns the n highest/lowest observations from a numeric vector. 23 | } 24 | \details{ 25 | Any NA values are stripped from \code{data} before computation takes place. 26 | } 27 | \examples{ 28 | # 5 lowest observations 29 | ds_tailobs(mtcarz$mpg, 5) 30 | 31 | # 5 highest observations 32 | ds_tailobs(mtcarz$mpg, 5, type = "high") 33 | 34 | # specify decimal places to display 35 | ds_tailobs(mtcarz$mpg, 5, decimals = 3) 36 | 37 | } 38 | \seealso{ 39 | \code{\link[dplyr]{top_n}} 40 | } 41 | -------------------------------------------------------------------------------- /man/ds_measures_location.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-describe.R 3 | \name{ds_measures_location} 4 | \alias{ds_measures_location} 5 | \title{Measures of location} 6 | \usage{ 7 | ds_measures_location(data, ..., trim = 0.05, decimals = 2) 8 | } 9 | \arguments{ 10 | \item{data}{A \code{data.frame} or \code{tibble} or numeric vector.} 11 | 12 | \item{...}{Column(s) in \code{data} or numeric vectors.} 13 | 14 | \item{trim}{The fraction of values to be trimmed before computing the mean.} 15 | 16 | \item{decimals}{An option to specify the exact number of decimal places to use. The default number of decimal places is 2.} 17 | } 18 | \description{ 19 | Returns the measures of location such as mean, median & mode. 20 | } 21 | \examples{ 22 | # single column 23 | ds_measures_location(mtcarz, mpg) 24 | 25 | # multiple columns 26 | ds_measures_location(mtcarz, mpg, disp) 27 | 28 | # all columns 29 | ds_measures_location(mtcarz) 30 | 31 | # vector 32 | ds_measures_location(mtcarz$mpg) 33 | 34 | # vectors of different length 35 | disp <- mtcarz$disp[1:10] 36 | ds_measures_location(mtcarz$mpg, disp) 37 | 38 | # decimal places 39 | ds_measures_location(mtcarz, disp, hp, decimals = 3) 40 | 41 | } 42 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | #' @importFrom utils available.packages update.packages 2 | #' @importFrom stats runif 3 | .onAttach <- function(...) { 4 | 5 | if (!interactive() || runif(1) > 0.1) return() 6 | 7 | pkgs <- available.packages() 8 | cran_version <- package_version(pkgs["descriptr", "Version"]) 9 | local_version <- packageVersion("descriptr") 10 | behind_cran <- cran_version > local_version 11 | 12 | tips <- c( 13 | "Learn more about descriptr at https://github.com/rsquaredacademy/descriptr/.", 14 | "Use suppressPackageStartupMessages() to eliminate package startup messages.", 15 | "Need help getting started with regression models? Visit: https://www.rsquaredacademy.com", 16 | "Check out our interactive app for quick data exploration. Visit: https://apps.rsquaredacademy.com/." 17 | ) 18 | 19 | tip <- sample(tips, 1) 20 | 21 | if (interactive()) { 22 | if (behind_cran) { 23 | msg <- c("A new version of descriptr is available with bug fixes and new features.") 24 | packageStartupMessage(msg, "\nWould you like to install it?") 25 | if (menu(c("Yes", "No")) == 1) { 26 | update.packages("descriptr") 27 | } 28 | } else { 29 | packageStartupMessage(paste(strwrap(tip), collapse = "\n")) 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/ds_freq_table.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-freq-table.R 3 | \name{ds_freq_table} 4 | \alias{ds_freq_table} 5 | \alias{plot.ds_freq_table} 6 | \alias{ds_freq_cont} 7 | \title{Frequency table} 8 | \usage{ 9 | ds_freq_table(data, col, bins = 5) 10 | 11 | \method{plot}{ds_freq_table}(x, print_plot = TRUE, ...) 12 | } 13 | \arguments{ 14 | \item{data}{A \code{data.frame} or a \code{tibble}.} 15 | 16 | \item{col}{Column in \code{data}.} 17 | 18 | \item{bins}{Number of intervals into which the data must be split.} 19 | 20 | \item{x}{An object of class \code{ds_freq_table}.} 21 | 22 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 23 | 24 | \item{...}{Further arguments to be passed to or from methods.} 25 | } 26 | \description{ 27 | Frequency table for categorical and continuous data and returns the 28 | frequency, cumulative frequency, frequency percent and cumulative frequency 29 | percent. \code{plot.ds_freq_table()} creates bar plot for the categorical 30 | data and histogram for continuous data. 31 | } 32 | \examples{ 33 | # categorical data 34 | ds_freq_table(mtcarz, cyl) 35 | 36 | # barplot 37 | k <- ds_freq_table(mtcarz, cyl) 38 | plot(k) 39 | 40 | # continuous data 41 | ds_freq_table(mtcarz, mpg) 42 | 43 | # barplot 44 | k <- ds_freq_table(mtcarz, mpg) 45 | plot(k) 46 | 47 | } 48 | \seealso{ 49 | \code{\link{ds_cross_table}} 50 | } 51 | -------------------------------------------------------------------------------- /CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who 4 | contribute through reporting issues, posting feature requests, updating documentation, 5 | submitting pull requests or patches, and other activities. 6 | 7 | We are committed to making participation in this project a harassment-free experience for 8 | everyone, regardless of level of experience, gender, gender identity and expression, 9 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. 10 | 11 | Examples of unacceptable behavior by participants include the use of sexual language or 12 | imagery, derogatory comments or personal attacks, trolling, public or private harassment, 13 | insults, or other unprofessional conduct. 14 | 15 | Project maintainers have the right and responsibility to remove, edit, or reject comments, 16 | commits, code, wiki edits, issues, and other contributions that are not aligned to this 17 | Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed 18 | from the project team. 19 | 20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by 21 | opening an issue or contacting one or more of the project maintainers. 22 | 23 | This Code of Conduct is adapted from the Contributor Covenant 24 | (http:contributor-covenant.org), version 1.0.0, available at 25 | http://contributor-covenant.org/version/1/0/0/ 26 | -------------------------------------------------------------------------------- /man/ds_cross_table.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-cross-table.R 3 | \name{ds_cross_table} 4 | \alias{ds_cross_table} 5 | \alias{plot.ds_cross_table} 6 | \alias{ds_twoway_table} 7 | \title{Two way table} 8 | \usage{ 9 | ds_cross_table(data, var_1, var_2) 10 | 11 | \method{plot}{ds_cross_table}(x, stacked = FALSE, proportional = FALSE, print_plot = TRUE, ...) 12 | 13 | ds_twoway_table(data, var_1, var_2) 14 | } 15 | \arguments{ 16 | \item{data}{A \code{data.frame} or a \code{tibble}.} 17 | 18 | \item{var_1}{First categorical variable.} 19 | 20 | \item{var_2}{Second categorical variable.} 21 | 22 | \item{x}{An object of class \code{cross_table}.} 23 | 24 | \item{stacked}{If \code{FALSE}, the columns of height are portrayed 25 | as stacked bars, and if \code{TRUE} the columns are portrayed as juxtaposed bars.} 26 | 27 | \item{proportional}{If \code{TRUE}, the height of the bars is proportional.} 28 | 29 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 30 | 31 | \item{...}{Further arguments to be passed to or from methods.} 32 | } 33 | \description{ 34 | Creates two way tables of categorical variables. The tables created can be 35 | visualized as bar plots and mosaic plots. 36 | } 37 | \examples{ 38 | # cross table 39 | k <- ds_cross_table(mtcarz, cyl, gear) 40 | k 41 | 42 | # bar plot 43 | plot(k) 44 | 45 | # stacked bar plot 46 | plot(k, stacked = TRUE) 47 | 48 | # proportional bar plot 49 | plot(k, proportional = TRUE) 50 | 51 | # returns tibble 52 | ds_twoway_table(mtcarz, cyl, gear) 53 | 54 | } 55 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [master, develop] 6 | pull_request: 7 | branches: [master, develop] 8 | 9 | name: R-CMD-check.yaml 10 | 11 | permissions: read-all 12 | 13 | jobs: 14 | R-CMD-check: 15 | runs-on: ${{ matrix.config.os }} 16 | 17 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 18 | 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | config: 23 | - {os: macos-latest, r: 'release'} 24 | - {os: windows-latest, r: 'release'} 25 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 26 | - {os: ubuntu-latest, r: 'release'} 27 | - {os: ubuntu-latest, r: 'oldrel-1'} 28 | 29 | env: 30 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 31 | R_KEEP_PKG_SOURCE: yes 32 | 33 | steps: 34 | - uses: actions/checkout@v4 35 | 36 | - uses: r-lib/actions/setup-pandoc@v2 37 | 38 | - uses: r-lib/actions/setup-r@v2 39 | with: 40 | r-version: ${{ matrix.config.r }} 41 | http-user-agent: ${{ matrix.config.http-user-agent }} 42 | use-public-rspm: true 43 | 44 | - uses: r-lib/actions/setup-r-dependencies@v2 45 | with: 46 | extra-packages: any::rcmdcheck 47 | needs: check 48 | 49 | - uses: r-lib/actions/check-r-package@v2 50 | with: 51 | upload-snapshots: true 52 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' 53 | -------------------------------------------------------------------------------- /R/ds-freq-mult.R: -------------------------------------------------------------------------------- 1 | freq_table2 <- function(data, name) UseMethod("freq_table2") 2 | 3 | freq_table2.default <- function(data, name) { 4 | 5 | var_name <- name 6 | 7 | dat <- 8 | data %>% 9 | dplyr::select(name) %>% 10 | dplyr::pull(1) %>% 11 | na.omit() 12 | 13 | if (!is.factor(dat)) { 14 | stop("Data must be categorical/qualitative.", call. = FALSE) 15 | } 16 | 17 | cq <- unique(sort(dat)) 18 | result <- as.vector(table(dat)) 19 | level_names <- levels(dat) 20 | data_len <- length(dat) 21 | len <- length(result) 22 | cum <- cumsum(result) 23 | per <- percent(result, data_len) 24 | cum_per <- percent(cum, data_len) 25 | 26 | ftable <- data.frame( 27 | Levels = level_names, 28 | Frequency = result, 29 | `Cum Frequency` = cum, 30 | Percent = per, 31 | `Cum Percent` = cum_per 32 | ) 33 | 34 | na_count <- 35 | data %>% 36 | dplyr::pull(name) %>% 37 | is.na() %>% 38 | sum() 39 | 40 | n_obs <- 41 | data %>% 42 | dplyr::pull(name) %>% 43 | length() 44 | 45 | if (na_count > 0) { 46 | na_data <- dplyr::pull(data, var_name) 47 | 48 | var_count <- 49 | na_data %>% 50 | table() %>% 51 | as.vector() %>% 52 | sum() 53 | 54 | na_freq <- n_obs - var_count 55 | } else { 56 | na_freq <- 0 57 | } 58 | 59 | result <- list( 60 | ftable = ftable, 61 | varname = var_name, 62 | na_count = na_freq, 63 | n = n_obs 64 | ) 65 | 66 | class(result) <- "freq_table2" 67 | return(result) 68 | } 69 | 70 | 71 | print.freq_table2 <- function(x, ...) { 72 | print_ftable2(x) 73 | } 74 | -------------------------------------------------------------------------------- /tests/testthat/test-screen.R: -------------------------------------------------------------------------------- 1 | test_that("output from ds_screener matches the expected result", { 2 | mt <- mtcars 3 | mt[, c(2, 8:11)] <- lapply(mt[, c(2, 8:11)], factor) 4 | mt[sample(1:nrow(mt), 12), c(2, 4, 7:10)] <- NA 5 | k <- ds_screener(mt) 6 | 7 | expect_equal(k$Rows, nrow(mt)) 8 | expect_equal(k$Columns, ncol(mt)) 9 | expect_equal(k$Variables, names(mt)) 10 | expect_equal(k$Types, c( 11 | "numeric", "factor", "numeric", "numeric", 12 | "numeric", "numeric", "numeric", 13 | "factor", "factor", "factor", "factor" 14 | ), ignore_attr = TRUE) 15 | expect_equal(unname(k$Count), rep(32, 11)) 16 | expect_equal(k$nlevels, list( 17 | mpg = 0, cyl = 3, disp = 0, hp = 0, 18 | drat = 0, wt = 0, qsec = 0, vs = 2, 19 | am = 2, gear = 3, carb = 6 20 | )) 21 | expect_equal(k$levels, list( 22 | mpg = NA, cyl = c("4", "6", "8"), 23 | disp = NA, hp = NA, drat = NA, wt = NA, 24 | qsec = NA, vs = c("0", "1"), 25 | am = c("0", "1"), gear = c("3", "4", "5"), 26 | carb = c("1", "2", "3", "4", "6", "8") 27 | )) 28 | expect_equal(k$Missing, c( 29 | mpg = 0, cyl = 12, disp = 0, hp = 12, 30 | drat = 0, wt = 0, qsec = 12, vs = 12, 31 | am = 12, gear = 12, carb = 0 32 | )) 33 | expect_equal(k$MissingPer, c( 34 | mpg = 0, cyl = 37.5, disp = 0, hp = 37.5, 35 | drat = 0, wt = 0, qsec = 37.5, vs = 37.5, 36 | am = 37.5, gear = 37.5, carb = 0 37 | )) 38 | expect_equal(k$MissingTotal, 72) 39 | expect_equal(k$MissingTotPer, 20.45) 40 | expect_equal(k$MissingRows, 12) 41 | expect_equal(k$MissingCols, 6) 42 | }) 43 | 44 | 45 | test_that("ds_screener throws the appropriate error", { 46 | expect_error(ds_screener(mtcars$mpg), "data must be a `data.frame` or `tibble`.") 47 | }) 48 | -------------------------------------------------------------------------------- /man/ds_group_summary.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-group-summary.R 3 | \name{ds_group_summary} 4 | \alias{ds_group_summary} 5 | \alias{plot.ds_group_summary} 6 | \title{Groupwise descriptive statistics} 7 | \usage{ 8 | ds_group_summary(data, group_by, cols) 9 | 10 | \method{plot}{ds_group_summary}(x, print_plot = TRUE, ...) 11 | } 12 | \arguments{ 13 | \item{data}{A \code{data.frame} or a \code{tibble}.} 14 | 15 | \item{group_by}{Column in \code{data}.} 16 | 17 | \item{cols}{Column in \code{data}.} 18 | 19 | \item{x}{An object of the class \code{ds_group_summary}.} 20 | 21 | \item{print_plot}{logical; if \code{TRUE}, prints the plot else returns a plot object.} 22 | 23 | \item{...}{Further arguments to be passed to or from methods.} 24 | } 25 | \value{ 26 | \code{ds_group_summary()} returns an object of class \code{"ds_group_summary"}. 27 | An object of class \code{"ds_group_summary"} is a list containing the 28 | following components: 29 | 30 | \item{stats}{A data frame containing descriptive statistics for the different 31 | levels of the factor variable.} 32 | \item{tidy_stats}{A tibble containing descriptive statistics for the different 33 | levels of the factor variable.} 34 | \item{plotdata}{Data for boxplot method.} 35 | } 36 | \description{ 37 | Descriptive statistics of a continuous variable for the different levels of 38 | a categorical variable. \code{boxplot.group_summary()} creates boxplots of 39 | the continuous variable for the different levels of the categorical variable. 40 | } 41 | \examples{ 42 | # ds_group summary 43 | ds_group_summary(mtcarz, cyl, mpg) 44 | 45 | # boxplot 46 | k <- ds_group_summary(mtcarz, cyl, mpg) 47 | plot(k) 48 | 49 | # tibble 50 | k$tidy_stats 51 | 52 | } 53 | \seealso{ 54 | \code{\link{ds_summary_stats}} 55 | } 56 | -------------------------------------------------------------------------------- /R/ds-multistats.R: -------------------------------------------------------------------------------- 1 | #' Tidy descriptive statistics 2 | #' 3 | #' Descriptive statistics for multiple variables. 4 | #' 5 | #' @param data A \code{tibble} or a \code{data.frame}. 6 | #' @param ... Columns in \code{x}. 7 | #' 8 | #' @return A tibble. 9 | #' 10 | #' @examples 11 | #' # all columns 12 | #' ds_tidy_stats(mtcarz) 13 | #' 14 | #' # multiple columns 15 | #' ds_tidy_stats(mtcarz, mpg, disp, hp) 16 | #' 17 | #' @section Deprecated Functions: 18 | #' \code{ds_multi_stats()} have been deprecated. Instead use \code{ds_tidy_stats()}. 19 | #' 20 | #' @export 21 | #' 22 | ds_tidy_stats <- function(data, ...) { 23 | 24 | check_df(data) 25 | 26 | vars <- rlang::quos(...) 27 | 28 | if (length(vars) < 1) { 29 | is_num <- sapply(data, is.numeric) 30 | if (!any(is_num == TRUE)) { 31 | stop("Data has no continuous variables.", call. = FALSE) 32 | } 33 | data <- data[, is_num] 34 | } else { 35 | data %<>% 36 | dplyr::select(!!! vars) 37 | } 38 | 39 | data %>% 40 | na.omit() %>% 41 | tidyr::gather(vars, values) %>% 42 | dplyr::group_by(vars) %>% 43 | dplyr::summarise_all( 44 | list( 45 | min = min, 46 | max = max, 47 | mean = mean, 48 | t_mean = trimmed_mean, 49 | median = median, 50 | mode = ds_mode, 51 | range = ds_range, 52 | variance = var, 53 | stdev = sd, 54 | skew = ds_skewness, 55 | kurtosis = ds_kurtosis, 56 | coeff_var = ds_cvar, 57 | q1 = quant1, 58 | q3 = quant3, 59 | iqrange = IQR 60 | ) 61 | ) 62 | } 63 | 64 | #' @export 65 | #' @rdname ds_tidy_stats 66 | #' @usage NULL 67 | #' 68 | ds_multi_stats <- function(data, ...) { 69 | .Deprecated("ds_tidy_stats()") 70 | ds_tidy_stats(data, ...) 71 | } 72 | -------------------------------------------------------------------------------- /man/ds_auto_freq_table.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-mult-table.R 3 | \name{ds_auto_freq_table} 4 | \alias{ds_auto_freq_table} 5 | \alias{ds_auto_cross_table} 6 | \alias{ds_tway_tables} 7 | \alias{ds_oway_tables} 8 | \title{Multiple One & Two Way Tables} 9 | \usage{ 10 | ds_auto_freq_table(data, ...) 11 | 12 | ds_auto_cross_table(data, ...) 13 | } 14 | \arguments{ 15 | \item{data}{A \code{data.frame} or \code{tibble}.} 16 | 17 | \item{...}{Column(s) in \code{data}.} 18 | } 19 | \description{ 20 | \code{ds_auto_freq_table} creates multiple one way tables by creating 21 | a frequency table for each categorical variable in a data frame. 22 | \code{ds_auto_cross_table} creates multiple two way tables by creating a cross 23 | table for each unique pair of categorical variables in a data frame. 24 | } 25 | \details{ 26 | \code{ds_auto_freq_table} is a extension of the \code{ds_freq_table} 27 | function. It creates a frequency table for each categorical variable in the 28 | dataframe. \code{ds_auto_cross_table} is a extension of the \code{ds_cross_table} 29 | function. It creates a two way table for each unique pair of categorical 30 | variables in the dataframe. 31 | } 32 | \section{Deprecated Functions}{ 33 | 34 | \code{ds_oway_tables()} and \code{ds_tway_tables()} have been deprecated. 35 | Instead use \code{ds_auto_freq_table()} and \code{ds_auto_cross_table()}. 36 | } 37 | 38 | \examples{ 39 | # frequency table for all columns 40 | ds_auto_freq_table(mtcarz) 41 | 42 | # frequency table for multiple columns 43 | ds_auto_freq_table(mtcarz, cyl, gear) 44 | 45 | # cross table for all columns 46 | ds_auto_cross_table(mtcarz) 47 | 48 | # cross table for multiple columns 49 | ds_auto_cross_table(mtcarz, cyl, gear, am) 50 | 51 | } 52 | \seealso{ 53 | \code{link{ds_freq_table}} \code{link{ds_cross_table}} 54 | } 55 | -------------------------------------------------------------------------------- /tests/testthat/test-group-summary.R: -------------------------------------------------------------------------------- 1 | test_that("output from ds_group_summary matches the expected result", { 2 | mt <- mtcars 3 | mt$cyl <- as.factor(mt$cyl) 4 | k <- ds_group_summary(mt, cyl, mpg) 5 | metrics <- c( 6 | "Obs", "Minimum", "Maximum", "Mean", "Median", "Mode", 7 | "Std. Deviation", "Variance", "Skewness", "Kurtosis", 8 | "Uncorrected SS", "Corrected SS", "Coeff Variation", 9 | "Std. Error Mean", "Range", "Interquartile Range" 10 | ) 11 | 12 | expect_equal(as.character(k$stats[, 1]), metrics) 13 | expect_equal(k$stats[, 2], c( 14 | 11.00, 21.40, 33.90, 26.66, 26.00, 22.80, 15 | 4.51, 20.34, 0.35, -1.43, 8023.83, 203.39, 16 | 16.91, 1.36, 12.50, 7.60 17 | )) 18 | expect_equal(k$stats[, 3], c( 19 | 7.00, 17.80, 21.40, 19.74, 19.70, 21.00, 20 | 1.45, 2.11, -0.26, -1.83, 2741.14, 12.68, 21 | 7.36, 0.55, 3.60, 2.35 22 | )) 23 | expect_equal(k$stats[, 4], c( 24 | 14.00, 10.40, 19.20, 15.10, 15.20, 10.40, 25 | 2.56, 6.55, -0.46, 0.33, 3277.34, 85.20, 26 | 16.95, 0.68, 8.80, 1.85 27 | )) 28 | }) 29 | 30 | 31 | test_that("ds_group_summary throws the appropriate error", { 32 | mt <- mtcars 33 | mt$cyl <- as.factor(mt$cyl) 34 | mt$am <- as.factor(mt$am) 35 | 36 | expect_error( 37 | ds_group_summary(mtcars, gear, mpg), 38 | "gear is not a categorical variable. The function expects an object of type `factor` but gear is of type `numeric`." 39 | ) 40 | expect_error( 41 | ds_group_summary(mt, cyl, am), 42 | "am is not a continuous variable. The function expects an object of type `numeric` or `integer` but am is of type `factor`." 43 | ) 44 | }) 45 | 46 | 47 | test_that("output from ds_group_summary plot is as expected", { 48 | skip_on_cran() 49 | 50 | k <- ds_group_summary(mtcarz, cyl, mpg) 51 | p <- plot(k) 52 | vdiffr::expect_doppelganger("group_summary", p$plot) 53 | }) 54 | 55 | 56 | -------------------------------------------------------------------------------- /R/ds-cross-mult.R: -------------------------------------------------------------------------------- 1 | cross_table2 <- function(var1, var2, name_1, name_2) UseMethod("cross_table2") 2 | 3 | cross_table2.default <- function(var1, var2, name_1, name_2) { 4 | 5 | var_1 <- deparse(substitute(var1)) 6 | var_2 <- deparse(substitute(var2)) 7 | var_na <- c(var_1, var_2) 8 | var_names <- c(name_1, name_2) 9 | x <- as.matrix(table(var1, var2)) 10 | n <- sum(x) 11 | row_name <- levels(var1) 12 | per_mat <- round(x / n, 3) 13 | per_mat_row <- apply(per_mat, 1, sum) 14 | per_mat_col <- apply(per_mat, 2, sum) 15 | per_mat <- cbind(per_mat, per_mat_row) 16 | per_mat <- suppressWarnings(rbind(per_mat, per_mat_col)) 17 | rowtotal <- apply(x, 1, sum) 18 | coltotal <- apply(x, 2, sum) 19 | rcent <- row_pct(x, rowtotal) 20 | rcent <- cbind(rcent, per_mat_row) 21 | rcent <- apply(rcent, c(1, 2), rounda) 22 | ccent <- col_pct(x, coltotal) 23 | ccent <- apply(ccent, c(1, 2), rounda) 24 | x <- cbind(x, rowtotal) 25 | x <- cbind(row_name, x) 26 | col_name <- levels(var2) 27 | col_names <- c(var_names[1], col_name, "Row Total") 28 | last_line <- c("Column Total", coltotal, n) 29 | 30 | result <- list(obs = n, 31 | variable_levels = col_name, 32 | row_name = row_name, 33 | variable_names = var_names, 34 | column_names = col_names, 35 | twowaytable = x, 36 | percent_table = per_mat, 37 | row_percent = rcent, 38 | column_percent = ccent, 39 | column_totals = last_line, 40 | percent_column = per_mat_col 41 | ) 42 | 43 | 44 | class(result) <- "cross_table2" 45 | return(result) 46 | } 47 | 48 | 49 | print.cross_table2 <- function(x, ...) { 50 | print_cross2(x) 51 | } 52 | -------------------------------------------------------------------------------- /R/ds-group-summary-interact.R: -------------------------------------------------------------------------------- 1 | #' Category wise descriptive statistics 2 | #' 3 | #' Descriptive statistics of a continuous variable for the combination of levels 4 | #' of two or more categorical variables. 5 | #' 6 | #' @param data A \code{data.frame} or a \code{tibble}. 7 | #' @param col Column in \code{data}; continuous variable. 8 | #' @param ... Columns in \code{data}; categorical variables. 9 | #' 10 | #' @examples 11 | #' ds_group_summary_interact(mtcarz, mpg, cyl, gear) 12 | #' 13 | #' @seealso \code{\link{ds_group_summary}} 14 | #' 15 | #' @export 16 | #' 17 | ds_group_summary_interact <- function(data, col, ...) { 18 | 19 | check_df(data) 20 | 21 | cvar_name <- deparse(substitute(col)) 22 | c_var <- rlang::enquo(col) 23 | check_numeric(data, !! c_var, cvar_name) 24 | 25 | g_var <- rlang::quos(...) 26 | gdata <- dplyr::select(data, !!! g_var) 27 | nums <- unlist(lapply(gdata, is.numeric)) 28 | non_type <- colnames(gdata[nums]) 29 | 30 | error_message <- paste0("Below grouping variables are not categorical: \n", 31 | paste("-", non_type, collapse = "\n")) 32 | 33 | if (length(non_type) > 0) { 34 | stop(error_message, call. = FALSE) 35 | } 36 | 37 | cats <- unlist(lapply(gdata, is.factor)) 38 | cnames <- colnames(gdata[cats]) 39 | 40 | data %>% 41 | dplyr::select(!!c_var, !!! g_var) %>% 42 | na.omit() %>% 43 | dplyr::mutate( 44 | Levels = interaction(!!! g_var) 45 | ) %>% 46 | dplyr::select(Levels, !! c_var) %>% 47 | dplyr::group_by(Levels) %>% 48 | dplyr::summarise_all(list( 49 | min = min, max = max, mean = mean, t_mean = trimmed_mean, 50 | median = median, mode = ds_mode, range = ds_range, 51 | variance = var, stdev = sd, skew = ds_skewness, 52 | kurtosis = ds_kurtosis, coeff_var = ds_cvar, q1 = quant1, 53 | q3 = quant3, iqrange = IQR)) %>% 54 | tidyr::separate(Levels, into = cnames) 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /tests/testthat/test-output.R: -------------------------------------------------------------------------------- 1 | mt <- mtcars 2 | mt$cyl <- as.factor(mt$cyl) 3 | mt$vs <- as.factor(mt$vs) 4 | 5 | test_that("output from print_cross matches expected output", { 6 | expect_snapshot(ds_cross_table(mt, cyl, vs)) 7 | }) 8 | 9 | test_that("output from print_screener matches expected output", { 10 | mt <- mtcars 11 | mt[, c(2, 8:11)] <- lapply(mt[, c(2, 8:11)], factor) 12 | expect_snapshot(ds_screener(mt)) 13 | }) 14 | 15 | 16 | test_that("output from print_fcont matches the expected result", { 17 | expect_snapshot(ds_freq_table(mtcars, mpg)) 18 | }) 19 | 20 | test_that("output from print_fcont is as expected when data has missing values", { 21 | mt <- mtcarz 22 | mt$mpg[c(3, 10, 14, 19)] <- NA 23 | expect_snapshot(ds_freq_table(mtcars, mpg)) 24 | }) 25 | 26 | 27 | test_that("output from freq_table matches the expected result", { 28 | expect_snapshot(ds_freq_table(mt, cyl)) 29 | }) 30 | 31 | test_that("output from freq_table is as expected when data has missing values", { 32 | mt <- mtcarz 33 | mt$cyl[c(3, 10, 14, 19)] <- NA 34 | expect_snapshot(ds_freq_table(mt, cyl)) 35 | }) 36 | 37 | 38 | test_that("output from group_summary matches the expected result", { 39 | expect_snapshot(ds_group_summary(mt, cyl, mpg)) 40 | }) 41 | 42 | 43 | test_that("output from print_ftable2 matches the expected result", { 44 | mt <- mtcars 45 | mt[, c(2, 8:11)] <- lapply(mt[, c(2, 8:11)], factor) 46 | expect_snapshot(ds_auto_freq_table(mt)) 47 | }) 48 | 49 | test_that("output from ds_auto_freq_table() is as expected when data has missing values", { 50 | fdata <- dplyr::select(mtcarz, cyl, gear) 51 | fdata$cyl[c(3, 10, 14, 19)] <- NA 52 | fdata$gear[c(3, 8, 17, 24)] <- NA 53 | expect_snapshot(ds_auto_freq_table(fdata)) 54 | }) 55 | 56 | 57 | test_that("output from print_cross2 matches the expected result", { 58 | mt <- mtcars 59 | mt[, c(2, 8, 9)] <- lapply(mt[, c(2, 8, 9)], factor) 60 | expect_snapshot(ds_auto_cross_table(mt)) 61 | }) 62 | 63 | 64 | -------------------------------------------------------------------------------- /vignettes/visualization.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Visualization" 3 | author: "Aravind Hebbali" 4 | date: "`r Sys.Date()`" 5 | output: rmarkdown::html_vignette 6 | vignette: > 7 | %\VignetteIndexEntry{Visualization} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | ```{r setup, include = FALSE} 13 | knitr::opts_chunk$set( 14 | collapse = TRUE, 15 | comment = "#>" 16 | ) 17 | ``` 18 | 19 | ```{r, echo=FALSE, message=FALSE} 20 | library(descriptr) 21 | library(dplyr) 22 | ``` 23 | 24 | ## Introduction 25 | 26 | In this document, we will introduce you to functions for generating different 27 | types of plots. 28 | 29 | ## Data 30 | 31 | We have modified the `mtcars` data to create a new data set `mtcarz`. The only 32 | difference between the two data sets is related to the variable types. 33 | 34 | ```{r egdata} 35 | str(mtcarz) 36 | ``` 37 | 38 | ## Continuous Data 39 | 40 | The following functions will create plots for all or subset of continuous 41 | variables in the data set. 42 | 43 | #### Histograms 44 | 45 | ```{r hist} 46 | ds_plot_histogram(mtcarz) 47 | ``` 48 | 49 | #### Density Plots 50 | 51 | ```{r density} 52 | ds_plot_density(mtcarz) 53 | ``` 54 | 55 | #### Box Plots 56 | 57 | ```{r box_single} 58 | ds_plot_box_single(mtcarz) 59 | ``` 60 | 61 | #### Scatter Plots 62 | 63 | ```{r scatter} 64 | ds_plot_scatter(mtcarz, mpg, disp, hp) 65 | ``` 66 | 67 | ## Categorical Data 68 | 69 | The following functions will create plots for all or subset of categorical 70 | variables in the data set. 71 | 72 | #### Bar Plot 73 | 74 | ```{r bar} 75 | ds_plot_bar(mtcarz) 76 | ``` 77 | 78 | #### Stacked Bar Plot 79 | 80 | ```{r bar_stacked} 81 | ds_plot_bar_stacked(mtcarz, cyl, gear, am) 82 | ``` 83 | 84 | #### Grouped Bar Plot 85 | 86 | ```{r bar_grouped} 87 | ds_plot_bar_grouped(mtcarz, cyl, gear, am) 88 | ``` 89 | 90 | #### Grouped Box Plots 91 | 92 | ```{r box_group} 93 | ds_plot_box_group(mtcarz, cyl, gear, mpg, disp) 94 | ``` 95 | -------------------------------------------------------------------------------- /man/ds_screener.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ds-screener.R 3 | \name{ds_screener} 4 | \alias{ds_screener} 5 | \alias{plot.ds_screener} 6 | \title{Screen data} 7 | \usage{ 8 | ds_screener(data) 9 | 10 | \method{plot}{ds_screener}(x, ...) 11 | } 12 | \arguments{ 13 | \item{data}{A \code{tibble} or a \code{data.frame}.} 14 | 15 | \item{x}{An object of class \code{ds_screener}.} 16 | 17 | \item{...}{Further arguments to be passed to or from methods.} 18 | } 19 | \value{ 20 | \code{ds_screener()} returns an object of class \code{"ds_screener"}. 21 | An object of class \code{"ds_screener"} is a list containing the 22 | following components: 23 | 24 | \item{Rows}{Number of rows in the data frame.} 25 | \item{Columns}{Number of columns in the data frame.} 26 | \item{Variables}{Names of the variables in the data frame.} 27 | \item{Types}{Class of the variables in the data frame.} 28 | \item{Count}{Length of the variables in the data frame.} 29 | \item{nlevels}{Number of levels of a factor variable.} 30 | \item{levels}{Levels of factor variables in the data frame.} 31 | \item{Missing}{Number of missing observations in each variable.} 32 | \item{MissingPer}{Percent of missing observations in each variable.} 33 | \item{MissingTotal}{Total number of missing observations in the data frame.} 34 | \item{MissingTotPer}{Total percent of missing observations in the data frame.} 35 | \item{MissingRows}{Total number of rows with missing observations in the 36 | data frame.} 37 | \item{MissingCols}{Total number of columns with missing observations in the 38 | data frame.} 39 | } 40 | \description{ 41 | Screen data and return details such as variable names, class, levels and 42 | missing values. \code{plot.ds_screener()} creates bar plots to visualize % 43 | of missing observations for each variable in a data set. 44 | } 45 | \examples{ 46 | # screen data 47 | ds_screener(mtcarz) 48 | ds_screener(airquality) 49 | 50 | # plot 51 | x <- ds_screener(airquality) 52 | plot(x) 53 | 54 | } 55 | -------------------------------------------------------------------------------- /.github/workflows/test-coverage.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [master, develop] 6 | pull_request: 7 | branches: [master, develop] 8 | 9 | name: test-coverage.yaml 10 | 11 | permissions: read-all 12 | 13 | jobs: 14 | test-coverage: 15 | runs-on: ubuntu-latest 16 | env: 17 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | 22 | - uses: r-lib/actions/setup-r@v2 23 | with: 24 | use-public-rspm: true 25 | 26 | - uses: r-lib/actions/setup-r-dependencies@v2 27 | with: 28 | extra-packages: any::covr, any::xml2 29 | needs: coverage 30 | 31 | - name: Test coverage 32 | run: | 33 | cov <- covr::package_coverage( 34 | quiet = FALSE, 35 | clean = FALSE, 36 | install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") 37 | ) 38 | covr::to_cobertura(cov) 39 | shell: Rscript {0} 40 | 41 | - uses: codecov/codecov-action@v4 42 | with: 43 | fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} 44 | file: ./cobertura.xml 45 | plugin: noop 46 | disable_search: true 47 | token: ${{ secrets.CODECOV_TOKEN }} 48 | 49 | - name: Show testthat output 50 | if: always() 51 | run: | 52 | ## -------------------------------------------------------------------- 53 | find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true 54 | shell: bash 55 | 56 | - name: Upload test results 57 | if: failure() 58 | uses: actions/upload-artifact@v4 59 | with: 60 | name: coverage-test-failures 61 | path: ${{ runner.temp }}/package 62 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(ds_cross_table,default) 4 | S3method(ds_freq_table,default) 5 | S3method(ds_group_summary,default) 6 | S3method(ds_screener,default) 7 | S3method(plot,ds_cross_table) 8 | S3method(plot,ds_freq_table) 9 | S3method(plot,ds_group_summary) 10 | S3method(plot,ds_screener) 11 | S3method(print,ds_cross_table) 12 | S3method(print,ds_freq_table) 13 | S3method(print,ds_group_summary) 14 | S3method(print,ds_screener) 15 | export(ds_auto_cross_table) 16 | export(ds_auto_freq_table) 17 | export(ds_auto_group_summary) 18 | export(ds_auto_summary_stats) 19 | export(ds_cross_table) 20 | export(ds_css) 21 | export(ds_cvar) 22 | export(ds_extreme_obs) 23 | export(ds_freq_cont) 24 | export(ds_freq_table) 25 | export(ds_gmean) 26 | export(ds_group_summary) 27 | export(ds_group_summary_interact) 28 | export(ds_hmean) 29 | export(ds_kurtosis) 30 | export(ds_launch_shiny_app) 31 | export(ds_mdev) 32 | export(ds_measures_location) 33 | export(ds_measures_symmetry) 34 | export(ds_measures_variation) 35 | export(ds_mode) 36 | export(ds_multi_stats) 37 | export(ds_oway_tables) 38 | export(ds_percentiles) 39 | export(ds_plot_bar) 40 | export(ds_plot_bar_grouped) 41 | export(ds_plot_bar_stacked) 42 | export(ds_plot_box_group) 43 | export(ds_plot_box_single) 44 | export(ds_plot_density) 45 | export(ds_plot_histogram) 46 | export(ds_plot_scatter) 47 | export(ds_range) 48 | export(ds_rindex) 49 | export(ds_screener) 50 | export(ds_skewness) 51 | export(ds_std_error) 52 | export(ds_summary_stats) 53 | export(ds_tailobs) 54 | export(ds_tidy_stats) 55 | export(ds_tway_tables) 56 | export(ds_twoway_table) 57 | import(ggplot2) 58 | import(magrittr) 59 | import(stats) 60 | importFrom(rlang,"!!") 61 | importFrom(rlang,sym) 62 | importFrom(stats,na.omit) 63 | importFrom(stats,runif) 64 | importFrom(utils,available.packages) 65 | importFrom(utils,combn) 66 | importFrom(utils,globalVariables) 67 | importFrom(utils,install.packages) 68 | importFrom(utils,menu) 69 | importFrom(utils,packageVersion) 70 | importFrom(utils,update.packages) 71 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v1.0.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | !function(a){"use strict";window.Toc={helpers:{findOrFilter:function(e,t){var n=e.find(t);return e.filter(t).add(n).filter(":not([data-toc-skip])")},generateUniqueIdBase:function(e){return a(e).text().trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,64).replace(/^-+|-+$/gm,"").toLowerCase()||e.tagName.toLowerCase()},generateUniqueId:function(e){for(var t=this.generateUniqueIdBase(e),n=0;;n++){var r=t;if(0')},createChildNavList:function(e){var t=this.createNavList();return e.append(t),t},generateNavEl:function(e,t){var n=a('');n.attr("href","#"+e),n.text(t);var r=a("
  • ");return r.append(n),r},generateNavItem:function(e){var t=this.generateAnchor(e),n=a(e),r=n.data("toc-text")||n.text();return this.generateNavEl(t,r)},getTopLevel:function(e){for(var t=1;t<=6;t++){if(1 localStorage.getItem('theme') 10 | const setStoredTheme = theme => localStorage.setItem('theme', theme) 11 | 12 | const getPreferredTheme = () => { 13 | const storedTheme = getStoredTheme() 14 | if (storedTheme) { 15 | return storedTheme 16 | } 17 | 18 | return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' 19 | } 20 | 21 | const setTheme = theme => { 22 | if (theme === 'auto') { 23 | document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) 24 | } else { 25 | document.documentElement.setAttribute('data-bs-theme', theme) 26 | } 27 | } 28 | 29 | function bsSetupThemeToggle () { 30 | 'use strict' 31 | 32 | const showActiveTheme = (theme, focus = false) => { 33 | var activeLabel, activeIcon; 34 | 35 | document.querySelectorAll('[data-bs-theme-value]').forEach(element => { 36 | const buttonTheme = element.getAttribute('data-bs-theme-value') 37 | const isActive = buttonTheme == theme 38 | 39 | element.classList.toggle('active', isActive) 40 | element.setAttribute('aria-pressed', isActive) 41 | 42 | if (isActive) { 43 | activeLabel = element.textContent; 44 | activeIcon = element.querySelector('span').classList.value; 45 | } 46 | }) 47 | 48 | const themeSwitcher = document.querySelector('#dropdown-lightswitch') 49 | if (!themeSwitcher) { 50 | return 51 | } 52 | 53 | themeSwitcher.setAttribute('aria-label', activeLabel) 54 | themeSwitcher.querySelector('span').classList.value = activeIcon; 55 | 56 | if (focus) { 57 | themeSwitcher.focus() 58 | } 59 | } 60 | 61 | window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { 62 | const storedTheme = getStoredTheme() 63 | if (storedTheme !== 'light' && storedTheme !== 'dark') { 64 | setTheme(getPreferredTheme()) 65 | } 66 | }) 67 | 68 | window.addEventListener('DOMContentLoaded', () => { 69 | showActiveTheme(getPreferredTheme()) 70 | 71 | document 72 | .querySelectorAll('[data-bs-theme-value]') 73 | .forEach(toggle => { 74 | toggle.addEventListener('click', () => { 75 | const theme = toggle.getAttribute('data-bs-theme-value') 76 | setTheme(theme) 77 | setStoredTheme(theme) 78 | showActiveTheme(theme, true) 79 | }) 80 | }) 81 | }) 82 | } 83 | 84 | setTheme(getPreferredTheme()); 85 | bsSetupThemeToggle(); 86 | -------------------------------------------------------------------------------- /R/ds-freq-numeric.R: -------------------------------------------------------------------------------- 1 | ds_freq_numeric <- function(data, variable, bins = 5) { 2 | 3 | check_df(data) 4 | var_name <- deparse(substitute(variable)) 5 | varyable <- rlang::enquo(variable) 6 | check_numeric(data, !! varyable, var_name) 7 | 8 | fdata <- 9 | data %>% 10 | dplyr::pull(!! varyable) %>% 11 | na.omit() 12 | 13 | if (!is.numeric(bins)) { 14 | stop("bins must be integer value", call. = FALSE) 15 | } 16 | 17 | if (is.numeric(bins)) { 18 | bins <- as.integer(bins) 19 | } 20 | 21 | var_name <- 22 | data %>% 23 | dplyr::select(!! varyable) %>% 24 | names() 25 | 26 | n_bins <- bins 27 | inta <- intervals(fdata, bins) 28 | result <- freq(fdata, bins, inta) 29 | data_len <- length(fdata) 30 | cum <- cumsum(result) 31 | per <- percent(result, data_len) 32 | cum_per <- percent(cum, data_len) 33 | 34 | na_count <- 35 | data %>% 36 | dplyr::pull(!! varyable) %>% 37 | is.na() %>% 38 | sum() 39 | 40 | if (na_count > 0) { 41 | na_freq <- na_count 42 | } else { 43 | na_freq <- 0 44 | } 45 | 46 | n_obs <- 47 | data %>% 48 | dplyr::pull(!! varyable) %>% 49 | length() 50 | 51 | lower_n <- n_bins + 1 52 | 53 | freq_data <- 54 | data.frame(lower = inta[-lower_n], 55 | upper = inta[-1], 56 | frequency = result, 57 | cumulative = cum, 58 | freq_percent = per, 59 | cum_percent = cum_per) 60 | 61 | utility <- list(breaks = inta, 62 | frequency = result, 63 | cumulative = cum, 64 | percent = per, 65 | cum_percent = cum_per, 66 | bins = n_bins, 67 | data = fdata, 68 | na_count = na_freq, 69 | n = n_obs, 70 | varname = var_name) 71 | 72 | out <- list(ftable = freq_data, 73 | utility = utility) 74 | 75 | return(out) 76 | } 77 | 78 | plot_ds_freq_numeric <- function(x, ...) { 79 | 80 | x_lab <- 81 | x %>% 82 | use_series(utility) %>% 83 | use_series(varname) 84 | 85 | k <- 86 | x %>% 87 | use_series(utility) %>% 88 | use_series(varname) %>% 89 | extract(1) %>% 90 | rlang::sym() 91 | 92 | bins <- 93 | x %>% 94 | use_series(utility) %>% 95 | use_series(frequency) %>% 96 | length() 97 | 98 | p <- 99 | data.frame(x = seq_len(x$utility$bins), value = x$utility$frequency) %>% 100 | ggplot() + 101 | geom_col( 102 | aes(x = x, y = value), width = 0.999, 103 | fill = "blue", color = "black" 104 | ) + 105 | xlab(x_lab) + ylab("Count") + 106 | ggtitle(paste("Histogram of", x_lab)) 107 | 108 | return(p) 109 | 110 | } 111 | -------------------------------------------------------------------------------- /R/ds-freq-table.R: -------------------------------------------------------------------------------- 1 | #' Frequency table 2 | #' 3 | #' Frequency table for categorical and continuous data and returns the 4 | #' frequency, cumulative frequency, frequency percent and cumulative frequency 5 | #' percent. \code{plot.ds_freq_table()} creates bar plot for the categorical 6 | #' data and histogram for continuous data. 7 | #' 8 | #' @param data A \code{data.frame} or a \code{tibble}. 9 | #' @param col Column in \code{data}. 10 | #' @param x An object of class \code{ds_freq_table}. 11 | #' @param bins Number of intervals into which the data must be split. 12 | #' @param print_plot logical; if \code{TRUE}, prints the plot else returns a plot object. 13 | #' @param ... Further arguments to be passed to or from methods. 14 | #' 15 | #' @examples 16 | #' # categorical data 17 | #' ds_freq_table(mtcarz, cyl) 18 | #' 19 | #' # barplot 20 | #' k <- ds_freq_table(mtcarz, cyl) 21 | #' plot(k) 22 | #' 23 | #' # continuous data 24 | #' ds_freq_table(mtcarz, mpg) 25 | #' 26 | #' # barplot 27 | #' k <- ds_freq_table(mtcarz, mpg) 28 | #' plot(k) 29 | #' 30 | #' @seealso \code{\link{ds_cross_table}} 31 | #' 32 | #' @export 33 | #' 34 | ds_freq_table <- function(data, col, bins = 5) UseMethod("ds_freq_table") 35 | 36 | #' @export 37 | #' 38 | ds_freq_table.default <- function(data, col, bins = 5) { 39 | 40 | varyable <- rlang::enquo(col) 41 | data %<>% 42 | dplyr::select(!! varyable) 43 | is_num <- sapply(data, is.numeric) 44 | is_factor <- sapply(data, is.factor) 45 | 46 | if (is_num) { 47 | result <- ds_freq_numeric(data, !! rlang::enquo(col), bins) 48 | } else if (is_factor) { 49 | result <- ds_freq_factor(data, !! rlang::enquo(col)) 50 | } else { 51 | var_name <- deparse(substitute(col)) 52 | stop(paste0(var_name, " is neither continuous nor categorical."), call. = FALSE) 53 | } 54 | 55 | class(result) <- "ds_freq_table" 56 | return(result) 57 | 58 | } 59 | 60 | #' @export 61 | #' 62 | print.ds_freq_table <- function(x, ...) { 63 | 64 | nx <- length(x$utility) 65 | if (nx == 4) { 66 | print_ftable(x) 67 | } else if (nx == 10) { 68 | print_fcont(x) 69 | } else { 70 | NULL 71 | } 72 | 73 | } 74 | 75 | #' @rdname ds_freq_table 76 | #' @export 77 | #' 78 | plot.ds_freq_table <- function(x, print_plot = TRUE, ...) { 79 | 80 | nx <- length(x$utility) 81 | if (nx == 4) { 82 | p <- plot_ds_freq_factor(x) 83 | if (print_plot) { 84 | print(p) 85 | } else { 86 | return(p) 87 | } 88 | } else if (nx == 10) { 89 | p <- plot_ds_freq_numeric(x) 90 | if (print_plot) { 91 | print(p) 92 | } else { 93 | return(p) 94 | } 95 | } else { 96 | NULL 97 | } 98 | 99 | } 100 | 101 | #' @export 102 | #' @rdname ds_freq_table 103 | #' @usage NULL 104 | #' 105 | ds_freq_cont <- function(data, variable, bins) { 106 | .Deprecated("ds_freq_table()") 107 | ds_freq_table(data, variable, bins) 108 | } 109 | -------------------------------------------------------------------------------- /vignettes/categorical-data.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Categorical Data" 3 | author: "Aravind Hebbali" 4 | date: "`r Sys.Date()`" 5 | output: rmarkdown::html_vignette 6 | vignette: > 7 | %\VignetteIndexEntry{Categorical Data} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | ```{r setup, include = FALSE} 13 | knitr::opts_chunk$set( 14 | collapse = TRUE, 15 | comment = "#>" 16 | ) 17 | ``` 18 | 19 | ```{r, echo=FALSE, message=FALSE} 20 | library(descriptr) 21 | library(dplyr) 22 | ``` 23 | 24 | ## Introduction 25 | 26 | In this document, we will introduce you to functions for exploring and 27 | visualizing categorical data. 28 | 29 | ## Data 30 | 31 | We have modified the `mtcars` data to create a new data set `mtcarz`. The only 32 | difference between the two data sets is related to the variable types. 33 | 34 | ```{r egdata} 35 | str(mtcarz) 36 | ``` 37 | 38 | ## Cross Tabulation 39 | 40 | The `ds_cross_table()` function creates two way tables of categorical variables. 41 | 42 | ```{r cross} 43 | ds_cross_table(mtcarz, cyl, gear) 44 | ``` 45 | 46 | If you want the above result as a tibble, use `ds_twoway_table()`. 47 | 48 | ```{r cross_tibble} 49 | ds_twoway_table(mtcarz, cyl, gear) 50 | ``` 51 | 52 | A `plot()` method has been defined which will generate: 53 | 54 | ### Grouped Bar Plots 55 | 56 | ```{r cross_group, fig.width=7, fig.height=7, fig.align='centre'} 57 | k <- ds_cross_table(mtcarz, cyl, gear) 58 | plot(k) 59 | ``` 60 | 61 | ### Stacked Bar Plots 62 | 63 | ```{r cross_stack, fig.width=7, fig.height=7, fig.align='centre'} 64 | k <- ds_cross_table(mtcarz, cyl, gear) 65 | plot(k, stacked = TRUE) 66 | ``` 67 | 68 | ### Proportional Bar Plots 69 | 70 | ```{r cross_prop, fig.width=7, fig.height=7, fig.align='centre'} 71 | k <- ds_cross_table(mtcarz, cyl, gear) 72 | plot(k, proportional = TRUE) 73 | ``` 74 | 75 | ## Frequency Table 76 | 77 | The `ds_freq_table()` function creates frequency tables. 78 | 79 | ```{r ftable} 80 | ds_freq_table(mtcarz, cyl) 81 | ``` 82 | 83 | A `plot()` method has been defined which will create a bar plot. 84 | 85 | ```{r ftable_bar, fig.width=7, fig.height=7, fig.align='centre'} 86 | k <- ds_freq_table(mtcarz, cyl) 87 | plot(k) 88 | ``` 89 | 90 | ## Multiple One Way Tables 91 | 92 | The `ds_auto_freq_table()` function creates multiple one way tables by creating a 93 | frequency table for each categorical variable in a data set. You can also 94 | specify a subset of variables if you do not want all the variables in the data 95 | set to be used. 96 | 97 | ```{r oway} 98 | ds_auto_freq_table(mtcarz) 99 | ``` 100 | 101 | ## Multiple Two Way Tables 102 | 103 | The `ds_auto_cross_table()` function creates multiple two way tables by creating a 104 | cross table for each unique pair of categorical variables in a data set. You 105 | can also specify a subset of variables if you do not want all the variables in 106 | the data set to be used. 107 | 108 | ```{r tway} 109 | ds_auto_cross_table(mtcarz, cyl, gear, am) 110 | ``` 111 | 112 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, echo = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "README-" 12 | ) 13 | ``` 14 | 15 | # descriptr 16 | 17 | > Generate descriptive statistics 18 | 19 | 20 | [![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/descriptr)](https://cran.r-project.org/package=descriptr) 21 | [![R-CMD-check](https://github.com/rsquaredacademy/descriptr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rsquaredacademy/descriptr/actions/workflows/R-CMD-check.yaml) 22 | [![Codecov test coverage](https://codecov.io/gh/rsquaredacademy/descriptr/graph/badge.svg)](https://app.codecov.io/gh/rsquaredacademy/descriptr) 23 | 24 | 25 | 26 | ## Installation 27 | 28 | ```{r cran-installation, eval = FALSE} 29 | # Install release version from CRAN 30 | install.packages("descriptr") 31 | 32 | # Install development version from GitHub 33 | # install.packages("devtools") 34 | devtools::install_github("rsquaredacademy/descriptr") 35 | 36 | # Install the development version from `rsquaredacademy` universe 37 | install.packages("descriptr", repos = "https://rsquaredacademy.r-universe.dev") 38 | ``` 39 | 40 | ## Articles 41 | 42 | - [Continuous Data](https://descriptr.rsquaredacademy.com/articles/continuous-data.html) 43 | - [Categorical Data](https://descriptr.rsquaredacademy.com/articles/categorical-data.html) 44 | - [Visualization](https://descriptr.rsquaredacademy.com/articles/visualization.html) 45 | 46 | ## Usage 47 | 48 | We will use a modified version of the `mtcars` data set in the below examples. 49 | The only difference between the data sets is related to the variable types. 50 | 51 | ```{r load, eval=TRUE, echo=FALSE} 52 | library(descriptr) 53 | ``` 54 | 55 | ```{r egdata} 56 | str(mtcarz) 57 | ``` 58 | 59 | ### Continuous Data 60 | 61 | #### Summary Statistics 62 | 63 | ```{r descript1} 64 | ds_summary_stats(mtcarz, mpg) 65 | ``` 66 | 67 | #### Frequency Distribution 68 | 69 | ```{r descript4} 70 | ds_freq_table(mtcarz, mpg) 71 | ``` 72 | 73 | ### Categorical Data 74 | 75 | #### One Way Table 76 | 77 | ```{r descript3} 78 | ds_freq_table(mtcarz, cyl) 79 | ``` 80 | 81 | #### Two Way Table 82 | 83 | ```{r descript2} 84 | ds_cross_table(mtcarz, cyl, gear) 85 | ``` 86 | 87 | ### Group Summary 88 | 89 | ```{r descript5} 90 | ds_group_summary(mtcarz, cyl, mpg) 91 | ``` 92 | 93 | #### Multiple Variable Statistics 94 | 95 | ```{r descriptr6} 96 | ds_tidy_stats(mtcarz, mpg, disp, hp) 97 | ``` 98 | 99 | ## Features 100 | 101 | - Summary statistics 102 | - Two way tables 103 | - One way table 104 | - Group wise summary 105 | - Multiple variable statistics 106 | - Multiple one way tables 107 | - Multiple two way tables 108 | 109 | ## Getting Help 110 | 111 | If you encounter a bug, please file a minimal reproducible example using 112 | [reprex](https://reprex.tidyverse.org/index.html) on github. For questions and 113 | clarifications, use [StackOverflow](https://stackoverflow.com/). 114 | 115 | -------------------------------------------------------------------------------- /.github/workflows/rhub.yaml: -------------------------------------------------------------------------------- 1 | # R-hub's generic GitHub Actions workflow file. It's canonical location is at 2 | # https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml 3 | # You can update this file to a newer version using the rhub2 package: 4 | # 5 | # rhub::rhub_setup() 6 | # 7 | # It is unlikely that you need to modify this file manually. 8 | 9 | name: R-hub 10 | run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}" 11 | 12 | on: 13 | workflow_dispatch: 14 | inputs: 15 | config: 16 | description: 'A comma separated list of R-hub platforms to use.' 17 | type: string 18 | default: 'linux,windows,macos' 19 | name: 20 | description: 'Run name. You can leave this empty now.' 21 | type: string 22 | id: 23 | description: 'Unique ID. You can leave this empty now.' 24 | type: string 25 | 26 | jobs: 27 | 28 | setup: 29 | runs-on: ubuntu-latest 30 | outputs: 31 | containers: ${{ steps.rhub-setup.outputs.containers }} 32 | platforms: ${{ steps.rhub-setup.outputs.platforms }} 33 | 34 | steps: 35 | # NO NEED TO CHECKOUT HERE 36 | - uses: r-hub/actions/setup@v1 37 | with: 38 | config: ${{ github.event.inputs.config }} 39 | id: rhub-setup 40 | 41 | linux-containers: 42 | needs: setup 43 | if: ${{ needs.setup.outputs.containers != '[]' }} 44 | runs-on: ubuntu-latest 45 | name: ${{ matrix.config.label }} 46 | strategy: 47 | fail-fast: false 48 | matrix: 49 | config: ${{ fromJson(needs.setup.outputs.containers) }} 50 | container: 51 | image: ${{ matrix.config.container }} 52 | 53 | steps: 54 | - uses: r-hub/actions/checkout@v1 55 | - uses: r-hub/actions/platform-info@v1 56 | with: 57 | token: ${{ secrets.RHUB_TOKEN }} 58 | job-config: ${{ matrix.config.job-config }} 59 | - uses: r-hub/actions/setup-deps@v1 60 | with: 61 | token: ${{ secrets.RHUB_TOKEN }} 62 | job-config: ${{ matrix.config.job-config }} 63 | - uses: r-hub/actions/run-check@v1 64 | with: 65 | token: ${{ secrets.RHUB_TOKEN }} 66 | job-config: ${{ matrix.config.job-config }} 67 | 68 | other-platforms: 69 | needs: setup 70 | if: ${{ needs.setup.outputs.platforms != '[]' }} 71 | runs-on: ${{ matrix.config.os }} 72 | name: ${{ matrix.config.label }} 73 | strategy: 74 | fail-fast: false 75 | matrix: 76 | config: ${{ fromJson(needs.setup.outputs.platforms) }} 77 | 78 | steps: 79 | - uses: r-hub/actions/checkout@v1 80 | - uses: r-hub/actions/setup-r@v1 81 | with: 82 | job-config: ${{ matrix.config.job-config }} 83 | token: ${{ secrets.RHUB_TOKEN }} 84 | - uses: r-hub/actions/platform-info@v1 85 | with: 86 | token: ${{ secrets.RHUB_TOKEN }} 87 | job-config: ${{ matrix.config.job-config }} 88 | - uses: r-hub/actions/setup-deps@v1 89 | with: 90 | job-config: ${{ matrix.config.job-config }} 91 | token: ${{ secrets.RHUB_TOKEN }} 92 | - uses: r-hub/actions/run-check@v1 93 | with: 94 | job-config: ${{ matrix.config.job-config }} 95 | token: ${{ secrets.RHUB_TOKEN }} 96 | -------------------------------------------------------------------------------- /R/ds-auto-summary.R: -------------------------------------------------------------------------------- 1 | #' Descriptive statistics and frquency tables 2 | #' 3 | #' Generate summary statistics & frequency table for all continuous variables in data. 4 | #' 5 | #' @param data A \code{data.frame} or \code{tibble}. 6 | #' @param ... Column(s) in \code{data}. 7 | #' 8 | #' @examples 9 | #' # all columns 10 | #' ds_auto_summary_stats(mtcarz) 11 | #' 12 | #' # multiple columns 13 | #' ds_auto_summary_stats(mtcarz, disp, hp) 14 | #' 15 | #' @export 16 | #' 17 | ds_auto_summary_stats <- function(data, ...) { 18 | 19 | check_df(data) 20 | var <- rlang::quos(...) 21 | is_num <- sapply(data, is.numeric) 22 | 23 | if (length(var) < 1) { 24 | if (!any(is_num == TRUE)) { 25 | stop("Data has no continuous variables.", call. = FALSE) 26 | } 27 | plot_data <- data[is_num] 28 | } else { 29 | data %<>% 30 | dplyr::select(!!! var) 31 | is_num <- sapply(data, is.numeric) 32 | if (!any(is_num == TRUE)) { 33 | stop("Data has no continuous variables.", call. = FALSE) 34 | } 35 | plot_data <- data[is_num] 36 | } 37 | 38 | if (ncol(plot_data) < 1) { 39 | stop("Data has no continuous variables.", call. = FALSE) 40 | } 41 | 42 | num_var <- names(plot_data) 43 | 44 | for (i in num_var) { 45 | 46 | ds_rule(paste0('Variable: ', i)) 47 | cat('\n\n') 48 | ds_rule(paste0('Summary Statistics')) 49 | cat('\n\n') 50 | print(ds_summary_stats(data, i)) 51 | cat('\n\n') 52 | ds_rule(paste0('Frequency Distribution')) 53 | cat('\n\n') 54 | print(ds_freq_table(data, i)) 55 | cat('\n\n\n') 56 | } 57 | 58 | } 59 | 60 | #' Tabulation 61 | #' 62 | #' Generate summary statistics for all continuous variables in data. 63 | #' 64 | #' @param data A \code{data.frame} or \code{tibble}. 65 | #' @param ... Column(s) in \code{data}. 66 | #' 67 | #' @examples 68 | #' # summary statistics of mpg & disp for each level of cyl & gear 69 | #' ds_auto_group_summary(mtcarz, cyl, gear, mpg, disp) 70 | #' 71 | #' @export 72 | #' 73 | ds_auto_group_summary <- function(data, ...) { 74 | 75 | check_df(data) 76 | var <- rlang::quos(...) 77 | 78 | is_num <- sapply(data, is.numeric) 79 | is_factor <- sapply(data, is.factor) 80 | 81 | if (length(var) < 1) { 82 | if (!any(is_factor == TRUE)) { 83 | stop("Data has no categorical variables.", call. = FALSE) 84 | } 85 | if (!any(is_num == TRUE)) { 86 | stop("Data has no continuous variables.", call. = FALSE) 87 | } 88 | plot_data <- cbind(data[is_factor] , data[is_num] ) 89 | } else { 90 | data %<>% 91 | dplyr::select(!!! var) 92 | is_num <- sapply(data, is.numeric) 93 | if (!any(is_num == TRUE)) { 94 | stop("Data has no continuous variables.", call. = FALSE) 95 | } 96 | is_factor <- sapply(data, is.factor) 97 | if (!any(is_factor == TRUE)) { 98 | stop("Data has no categorical variables.", call. = FALSE) 99 | } 100 | plot_data <- cbind(data[is_factor], data[is_num]) 101 | } 102 | 103 | is_num <- sapply(plot_data, is.numeric) 104 | is_factor <- sapply(plot_data, is.factor) 105 | num_data <- plot_data[is_num] 106 | fact_data <- plot_data[is_factor] 107 | fact_var <- names(fact_data) 108 | num_var <- names(num_data) 109 | combs <- expand.grid(fact_var, num_var) 110 | myplots <- list() 111 | n <- nrow(combs) 112 | 113 | for (i in seq_len(n)) { 114 | print(ds_group_summary(data, !! sym(as.character(combs[i, 1])), !! sym(as.character(combs[i, 2])))) 115 | cat('\n\n\n') 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://descriptr.rsquaredacademy.com 2 | template: 3 | bootstrap: 5 4 | 5 | authors: 6 | Aravind Hebbali: 7 | href: https://www.aravindhebbali.com 8 | 9 | templates: 10 | params: 11 | bootswatch: cerulean 12 | 13 | navbar: 14 | title: "descriptr" 15 | type: inverse 16 | left: 17 | - text: "Home" 18 | href: index.html 19 | - text: "Guides" 20 | menu: 21 | - text: "Continuous Data" 22 | href: articles/continuous-data.html 23 | - text: "Categorical Data" 24 | href: articles/categorical-data.html 25 | - text: "Visualization" 26 | href: articles/visualization.html 27 | - text: "Reference" 28 | menu: 29 | - text: "Functions" 30 | href: reference/index.html 31 | - text: "News" 32 | href: news/index.html 33 | right: 34 | - icon: fa-github 35 | href: https://github.com/rsquaredacademy/descriptr 36 | 37 | 38 | home: 39 | links: 40 | - text: Our R packages 41 | href: https://pkgs.rsquaredacademy.com 42 | - text: Read our blog 43 | href: https://blog.rsquaredacademy.com 44 | - text: Our ebooks 45 | href: https://ebooks.rsquaredacademy.com 46 | - text: Online courses 47 | href: https://www.rsquaredacademy.com 48 | 49 | reference: 50 | - title: Shiny App 51 | desc: > 52 | Launches shiny app for interactive exploration of data sets. 53 | contents: 54 | - ds_launch_shiny_app 55 | 56 | - title: Data Screening 57 | desc: > 58 | The `screener()` function will screen data frames and return details such 59 | as variable names, class, levels and missing values. The `plot.screener()` 60 | creates bar plots to visualize % of missing observations for each variable 61 | in a data frame. 62 | contents: 63 | - ds_screener 64 | 65 | - title: Continuous Data 66 | desc: > 67 | The following functions ease the process of generating and visualizing 68 | descriptive statistics for continuous data. 69 | contents: 70 | - ds_auto_summary_stats 71 | - ds_extreme_obs 72 | - ds_freq_table 73 | - ds_measures_location 74 | - ds_measures_symmetry 75 | - ds_measures_variation 76 | - ds_percentiles 77 | - ds_summary_stats 78 | - ds_tidy_stats 79 | 80 | - title: Categorical Data 81 | desc: > 82 | The following functions ease the process of generating and visualizing 83 | descriptive statistics for categorical data. 84 | contents: 85 | - ds_auto_cross_table 86 | - ds_auto_freq_table 87 | - ds_cross_table 88 | - ds_freq_table 89 | 90 | - title: Grouped Summary 91 | desc: > 92 | The following functions generate grouped summary statistics. 93 | contents: 94 | - ds_auto_group_summary 95 | - ds_group_summary 96 | - ds_group_summary_interact 97 | 98 | - title: Visualization 99 | desc: > 100 | The following functions generate plots for different data types. 101 | contents: 102 | - ds_plot_bar 103 | - ds_plot_bar_grouped 104 | - ds_plot_bar_stacked 105 | - ds_plot_box_group 106 | - ds_plot_box_single 107 | - ds_plot_density 108 | - ds_plot_histogram 109 | - ds_plot_scatter 110 | 111 | - title: Other Functions 112 | desc: > 113 | A set of functions used to generate `summary_stats`. 114 | contents: 115 | - ds_css 116 | - ds_cvar 117 | - ds_gmean 118 | - ds_hmean 119 | - ds_kurtosis 120 | - ds_mdev 121 | - ds_mode 122 | - ds_range 123 | - ds_rindex 124 | - ds_skewness 125 | - ds_std_error 126 | - ds_tailobs 127 | 128 | - title: Data 129 | desc: > 130 | descriptr comes with a built-in dataset `hsb` which is used to 131 | illustrate the functions as well as for running tests. 132 | contents: 133 | - hsb 134 | - mtcarz 135 | -------------------------------------------------------------------------------- /R/ds-summary-stats.R: -------------------------------------------------------------------------------- 1 | #' @title Descriptive statistics 2 | #' 3 | #' @description Range of descriptive statistics for continuous data. 4 | #' 5 | #' @param data An object of type \code{numeric} or \code{data.frame}. 6 | #' @param ... Column(s) in \code{data}. 7 | #' 8 | #' @examples 9 | #' # numeric data 10 | #' ds_summary_stats(mtcarz$mpg) 11 | #' 12 | #' # single variable 13 | #' ds_summary_stats(mtcarz, mpg) 14 | #' 15 | #' # multiple variables 16 | #' ds_summary_stats(mtcarz, mpg, disp, hp) 17 | #' 18 | #' # all variables 19 | #' ds_summary_stats(mtcarz) 20 | #' 21 | #' @importFrom rlang !! 22 | #' @importFrom stats na.omit 23 | #' 24 | #' @seealso \code{\link[base]{summary}} 25 | #' \code{\link{ds_freq_table}} \code{\link{ds_cross_table}} 26 | #' 27 | #' @export 28 | #' 29 | ds_summary_stats <- function(data, ...) { 30 | 31 | if (is.numeric(data)) { 32 | print(ds_summary(data)) 33 | } else { 34 | 35 | check_df(data) 36 | var <- rlang::quos(...) 37 | 38 | if (length(var) < 1) { 39 | is_num <- sapply(data, is.numeric) 40 | if (!any(is_num == TRUE)) { 41 | stop("Data has no continuous variables.", call. = FALSE) 42 | } 43 | data <- data[is_num] 44 | } else { 45 | data %<>% 46 | dplyr::select(!!! var) 47 | is_num <- sapply(data, is.numeric) 48 | if (!any(is_num == TRUE)) { 49 | stop("Data has no continuous variables.", call. = FALSE) 50 | } 51 | } 52 | 53 | col_names <- names(data) 54 | for (i in col_names) { 55 | ds_rule(paste0('Variable: ', i)) 56 | cat('\n\n') 57 | print(ds_summary(data, i)) 58 | cat('\n\n\n') 59 | } 60 | } 61 | } 62 | 63 | ds_summary <- function(data, variable) UseMethod("ds_summary") 64 | 65 | ds_summary.default <- function(data, variable) { 66 | 67 | if (is.numeric(data)) { 68 | odata <- data 69 | sdata <- na.omit(data) 70 | } else { 71 | check_df(data) 72 | vary <- rlang::enquo(variable) 73 | var_name <- deparse(substitute(variable)) 74 | check_numeric(data, !! vary, var_name) 75 | 76 | odata <- dplyr::pull(data, !! vary) 77 | 78 | sdata <- 79 | data %>% 80 | dplyr::pull(!! vary) %>% 81 | na.omit() 82 | } 83 | 84 | low <- ds_tailobs(sdata, 5, "low") 85 | high <- ds_tailobs(sdata, 5, "high") 86 | low_val <- ds_rindex(sdata, low) 87 | high_val <- ds_rindex(sdata, high) 88 | 89 | result <- 90 | list(obs = length(odata), 91 | missing = sum(is.na(odata)), 92 | avg = mean(sdata), 93 | tavg = mean(sdata, trim = 0.05), 94 | stdev = sd(sdata), 95 | variance = var(sdata), 96 | skew = ds_skewness(sdata), 97 | kurtosis = ds_kurtosis(sdata), 98 | uss = stat_uss(sdata), 99 | css = ds_css(sdata), 100 | cvar = ds_cvar(sdata), 101 | sem = ds_std_error(sdata), 102 | median = median(sdata), 103 | mode = ds_mode(sdata), 104 | range = ds_range(sdata), 105 | min = min(sdata), 106 | Max = max(sdata), 107 | iqrange = IQR(sdata), 108 | per99 = quantile(sdata, 0.99), 109 | per90 = quantile(sdata, 0.90), 110 | per95 = quantile(sdata, 0.95), 111 | per75 = quantile(sdata, 0.75), 112 | per25 = quantile(sdata, 0.25), 113 | per10 = quantile(sdata, 0.10), 114 | per5 = quantile(sdata, 0.05), 115 | per1 = quantile(sdata, 0.01), 116 | lowobs = low, 117 | highobs = high, 118 | lowobsi = low_val, 119 | highobsi = high_val) 120 | 121 | class(result) <- "ds_summary" 122 | return(result) 123 | } 124 | 125 | print.ds_summary <- function(x, ...) { 126 | print_stats(x) 127 | } 128 | 129 | -------------------------------------------------------------------------------- /tests/testthat/test-cross-table.R: -------------------------------------------------------------------------------- 1 | test_that("output from ds_cross_table matches expected results", { 2 | k <- ds_cross_table(hsb, ses, female) 3 | 4 | expect_equal(k$utility$obs, 200) 5 | 6 | expect_equal(k$utility$var2_levels, c("0", "1")) 7 | 8 | expect_equal(k$utility$var1_levels, c("1", "2", "3")) 9 | 10 | expect_equal(k$utility$varnames, c("ses", "female")) 11 | 12 | expect_equal(k$utility$twowaytable[, 1], c("1", "2", "3")) 13 | 14 | expect_equal(k$utility$twowaytable[, 2], c("15", "47", "29")) 15 | 16 | expect_equal(k$utility$twowaytable[, 3], c("32", "48", "29")) 17 | 18 | expect_equal(k$utility$twowaytable[, 4], c("47", "95", "58")) 19 | 20 | expect_equal(colnames(k$utility$twowaytable), c("", "0", "1", "rowtotal")) 21 | 22 | expect_equal(k$utility$percent_table[, 1], c(0.075, 0.235, 0.145, 0.455), ignore_attr = TRUE) 23 | 24 | expect_equal(k$utility$percent_table[, 2], c(0.160, 0.240, 0.145, 0.545), ignore_attr = TRUE) 25 | 26 | expect_equal(k$utility$percent_table[, 3], c(0.235, 0.475, 0.290, 1.000), ignore_attr = TRUE) 27 | 28 | expect_equal(colnames(k$utility$percent_table), c("0", "1", "row_pct")) 29 | 30 | expect_equal(rownames(k$utility$percent_table), c("", "", "", "col_pct")) 31 | 32 | expect_equal(k$utility$row_percent[, 1], c(0.32, 0.49, 0.50)) 33 | 34 | expect_equal(k$utility$row_percent[, 2], c(0.68, 0.51, 0.50)) 35 | 36 | expect_equal(k$utility$row_percent[3, 3], c(0.29), ignore_attr = TRUE) 37 | 38 | expect_equal(k$utility$column_percent[, 1], c(0.16, 0.52, 0.32)) 39 | 40 | expect_equal(k$utility$column_percent[, 2], c(0.29, 0.44, 0.27)) 41 | 42 | expect_equal(unname(k$utility$column_totals), c(91, 109)) 43 | 44 | expect_equal(unname(k$utility$percent_column), c(0.455, 0.545)) 45 | }) 46 | 47 | 48 | test_that("ouput from plot.ds_cross_table matches expected output", { 49 | skip_on_cran() 50 | 51 | # cross table 52 | k <- ds_cross_table(mtcarz, cyl, gear) 53 | 54 | # bar plot 55 | p1 <- plot(k) 56 | vdiffr::expect_doppelganger("cross_bar", p1$plot) 57 | 58 | # stacked bar plot 59 | p2 <- plot(k, stacked = TRUE) 60 | vdiffr::expect_doppelganger("cross_bar_stacked", p2$plot) 61 | 62 | # proportional bar plot 63 | p3 <- plot(k, proportional = TRUE) 64 | vdiffr::expect_doppelganger("cross_bar_proportional", p3$plot) 65 | }) 66 | 67 | test_that("ds_cross_table throws appropriate error", { 68 | 69 | x <- 1:10 70 | expect_error(ds_cross_table(x), 'data must be a `data.frame` or `tibble`.') 71 | expect_error(ds_cross_table(mtcarz, mpg, cyl), 'mpg is not a categorical variable. The function expects an object of type `factor` but mpg is of type `numeric`.') 72 | expect_error(ds_cross_table(mtcarz, cyl, disp), 'disp is not a categorical variable. The function expects an object of type `factor` but disp is of type `numeric`.') 73 | 74 | }) 75 | 76 | test_that("output from ds_twoway_table is as expected", { 77 | actual <- sum(ds_twoway_table(mtcarz, cyl, gear)[[3]]) 78 | expected <- 32 79 | expect_equal(actual, expected) 80 | }) 81 | 82 | test_that("ds_twoway_table throws appropriate error", { 83 | 84 | x <- 1:10 85 | expect_error(ds_twoway_table(x), 'data must be a `data.frame` or `tibble`.') 86 | expect_error(ds_twoway_table(mtcarz, mpg, cyl), 'mpg is not a categorical variable. The function expects an object of type `factor` but mpg is of type `numeric`.') 87 | expect_error(ds_twoway_table(mtcarz, cyl, disp), 'disp is not a categorical variable. The function expects an object of type `factor` but disp is of type `numeric`.') 88 | 89 | }) 90 | 91 | 92 | test_that("output from ds_cross_table is as expected", { 93 | expect_snapshot(ds_cross_table(mtcarz, cyl, gear)) 94 | }) 95 | 96 | test_that("get_names works as expected", { 97 | 98 | mt <- mtcarz["gear"] 99 | mt$gear <- as.character(mt$gear) 100 | actual <- get_names(mt$gear) 101 | expected <- c("3", "4", "5") 102 | expect_equal(actual, expected) 103 | 104 | }) 105 | -------------------------------------------------------------------------------- /docs/LICENSE-text.html: -------------------------------------------------------------------------------- 1 | 2 | License • descriptr 3 | Skip to contents 4 | 5 | 6 |
    36 |
    37 |
    42 | 43 |
    YEAR: 2016-18
    44 | COPYRIGHT HOLDER: Aravind Hebbali
    45 | 
    46 | 47 |
    48 | 49 | 50 |
    59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/plots/ds-plot-box-single-2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 100 38 | 200 39 | 300 40 | 400 41 | 42 | 43 | 44 | 45 | 46 | 1 47 | 48 | disp 49 | ds_plot_box_single_2 50 | 51 | 52 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/plots/ds-plot-box-single-4.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 100 38 | 200 39 | 300 40 | 400 41 | 42 | 43 | 44 | 45 | 46 | 1 47 | 48 | disp 49 | ds_plot_box_single_4 50 | 51 | 52 | -------------------------------------------------------------------------------- /R/ds-screener.R: -------------------------------------------------------------------------------- 1 | #' Screen data 2 | #' 3 | #' Screen data and return details such as variable names, class, levels and 4 | #' missing values. \code{plot.ds_screener()} creates bar plots to visualize % 5 | #' of missing observations for each variable in a data set. 6 | #' 7 | #' @param data A \code{tibble} or a \code{data.frame}. 8 | #' @param x An object of class \code{ds_screener}. 9 | #' @param ... Further arguments to be passed to or from methods. 10 | #' 11 | #' @return \code{ds_screener()} returns an object of class \code{"ds_screener"}. 12 | #' An object of class \code{"ds_screener"} is a list containing the 13 | #' following components: 14 | #' 15 | #' \item{Rows}{Number of rows in the data frame.} 16 | #' \item{Columns}{Number of columns in the data frame.} 17 | #' \item{Variables}{Names of the variables in the data frame.} 18 | #' \item{Types}{Class of the variables in the data frame.} 19 | #' \item{Count}{Length of the variables in the data frame.} 20 | #' \item{nlevels}{Number of levels of a factor variable.} 21 | #' \item{levels}{Levels of factor variables in the data frame.} 22 | #' \item{Missing}{Number of missing observations in each variable.} 23 | #' \item{MissingPer}{Percent of missing observations in each variable.} 24 | #' \item{MissingTotal}{Total number of missing observations in the data frame.} 25 | #' \item{MissingTotPer}{Total percent of missing observations in the data frame.} 26 | #' \item{MissingRows}{Total number of rows with missing observations in the 27 | #' data frame.} 28 | #' \item{MissingCols}{Total number of columns with missing observations in the 29 | #' data frame.} 30 | #' 31 | #' @examples 32 | #' # screen data 33 | #' ds_screener(mtcarz) 34 | #' ds_screener(airquality) 35 | #' 36 | #' # plot 37 | #' x <- ds_screener(airquality) 38 | #' plot(x) 39 | #' 40 | #' @export 41 | #' 42 | ds_screener <- function(data) UseMethod("ds_screener") 43 | 44 | #' @export 45 | #' 46 | ds_screener.default <- function(data) { 47 | 48 | check_df(data) 49 | 50 | rows <- nrow(data) 51 | cols <- ncol(data) 52 | varnames <- names(data) 53 | datatype <- sapply(data, class) 54 | counts <- sapply(data, length) 55 | nlev <- lapply(data, nlevels) 56 | lev <- lapply(data, levels) 57 | 58 | for (i in seq_len(length(lev))) { 59 | if (is.null(lev[[i]])) { 60 | lev[[i]] <- NA 61 | } 62 | } 63 | 64 | mvalues <- sapply(data, function(z) sum(is.na(z))) 65 | mvaluesper <- round((mvalues / counts) * 100, 2) 66 | mtotal <- sum(is.na(data)) 67 | mtotalper <- round((mtotal / sum(counts)) * 100, 2) 68 | mrows <- sum(!complete.cases(data)) 69 | mcols <- sum(mvalues != 0) 70 | 71 | result <- list(Rows = rows, 72 | Columns = cols, 73 | Variables = varnames, 74 | Types = datatype, 75 | Count = counts, 76 | nlevels = nlev, 77 | levels = lev, 78 | Missing = mvalues, 79 | MissingPer = mvaluesper, 80 | MissingTotal = mtotal, 81 | MissingTotPer = mtotalper, 82 | MissingRows = mrows, 83 | MissingCols = mcols) 84 | 85 | class(result) <- "ds_screener" 86 | 87 | return(result) 88 | } 89 | 90 | #' @export 91 | print.ds_screener <- function(x, ...) { 92 | print_screen(x) 93 | } 94 | 95 | #' @rdname ds_screener 96 | #' @export 97 | #' 98 | plot.ds_screener <- function(x, ...) { 99 | 100 | `% Missing` <- NULL 101 | mydat <- data.frame(x = names(x$MissingPer), y = x$MissingPer) 102 | mydat$y <- mydat$y / 100 103 | mydat$color <- ifelse(mydat$y >= 0.1, ">= 10%", "< 10%") 104 | names(mydat) <- c("x", "y", "% Missing") 105 | 106 | ggplot(mydat) + 107 | geom_col(aes(x = reorder(x, y), y = y, fill = `% Missing`)) + 108 | scale_y_continuous(labels = scales::percent_format()) + 109 | xlab("Column") + ylab("Percentage") + 110 | ggtitle("Missing Values (%)") + 111 | scale_fill_manual(values = c("green", "red")) 112 | 113 | } 114 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/plots/ds-plot-bar-1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 0 37 | 5 38 | 10 39 | 40 | 41 | 42 | 43 | 44 | 45 | 4 46 | 6 47 | 8 48 | cyl 49 | count 50 | ds_plot_bar_1 51 | 52 | 53 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/plots/ds-plot-bar-3.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 0 37 | 5 38 | 10 39 | 40 | 41 | 42 | 43 | 44 | 45 | 4 46 | 6 47 | 8 48 | cyl 49 | count 50 | ds_plot_bar_3 51 | 52 | 53 | -------------------------------------------------------------------------------- /R/ds-mult-table.R: -------------------------------------------------------------------------------- 1 | #' @title Multiple One & Two Way Tables 2 | #' @description \code{ds_auto_freq_table} creates multiple one way tables by creating 3 | #' a frequency table for each categorical variable in a data frame. 4 | #' \code{ds_auto_cross_table} creates multiple two way tables by creating a cross 5 | #' table for each unique pair of categorical variables in a data frame. 6 | #' @param data A \code{data.frame} or \code{tibble}. 7 | #' @param ... Column(s) in \code{data}. 8 | #' @details \code{ds_auto_freq_table} is a extension of the \code{ds_freq_table} 9 | #' function. It creates a frequency table for each categorical variable in the 10 | #' dataframe. \code{ds_auto_cross_table} is a extension of the \code{ds_cross_table} 11 | #' function. It creates a two way table for each unique pair of categorical 12 | #' variables in the dataframe. 13 | #' @section Deprecated Functions: 14 | #' \code{ds_oway_tables()} and \code{ds_tway_tables()} have been deprecated. 15 | #' Instead use \code{ds_auto_freq_table()} and \code{ds_auto_cross_table()}. 16 | #' @examples 17 | #' # frequency table for all columns 18 | #' ds_auto_freq_table(mtcarz) 19 | #' 20 | #' # frequency table for multiple columns 21 | #' ds_auto_freq_table(mtcarz, cyl, gear) 22 | #' 23 | #' # cross table for all columns 24 | #' ds_auto_cross_table(mtcarz) 25 | #' 26 | #' # cross table for multiple columns 27 | #' ds_auto_cross_table(mtcarz, cyl, gear, am) 28 | #' 29 | #' @seealso \code{link{ds_freq_table}} \code{link{ds_cross_table}} 30 | #' @export 31 | #' 32 | ds_auto_freq_table <- function(data, ...) { 33 | 34 | check_df(data) 35 | var <- rlang::quos(...) 36 | is_factor <- sapply(data, is.factor) 37 | 38 | if (length(var) < 1) { 39 | if (!any(is_factor == TRUE)) { 40 | stop("Data has no categorical variables.", call. = FALSE) 41 | } 42 | plot_data <- data[is_factor] 43 | } else { 44 | data %<>% 45 | dplyr::select(!!! var) 46 | is_factor <- sapply(data, is.factor) 47 | if (!any(is_factor == TRUE)) { 48 | stop("Data has no categorical variables.", call. = FALSE) 49 | } 50 | plot_data <- data[is_factor] 51 | } 52 | 53 | factor_var <- names(plot_data) 54 | n <- length(factor_var) 55 | 56 | for (i in seq_len(n)) { 57 | k <- freq_table2(plot_data[i], factor_var[i]) 58 | print(k) 59 | } 60 | 61 | } 62 | 63 | 64 | 65 | #' @rdname ds_auto_freq_table 66 | #' @export 67 | #' 68 | ds_auto_cross_table <- function(data, ...) { 69 | 70 | check_df(data) 71 | var <- rlang::quos(...) 72 | is_factor <- sapply(data, is.factor) 73 | 74 | if (length(var) < 1) { 75 | if (!any(is_factor == TRUE)) { 76 | stop("Data has no categorical variables.", call. = FALSE) 77 | } 78 | plot_data <- data[is_factor] 79 | } else { 80 | data %<>% 81 | dplyr::select(!!! var) 82 | is_factor <- sapply(data, is.factor) 83 | if (!any(is_factor == TRUE)) { 84 | stop("Data has no categorical variables.", call. = FALSE) 85 | } 86 | if (length(is_factor) < 2) { 87 | stop("Two way table requires at least 2 categorical variables.", call. = FALSE) 88 | } else { 89 | plot_data <- data[is_factor] 90 | } 91 | } 92 | 93 | factor_var <- names(plot_data) 94 | factor_start <- combn(factor_var, 2) 95 | n <- dim(factor_start)[2] 96 | 97 | cat( 98 | formatter(" Cell Contents\n"), 99 | "|---------------|\n", 100 | "|", formatter("Frequency"), "|\n", 101 | "|", formatter("Percent"), "|\n", 102 | "|", formatter("Row Pct"), "|\n", 103 | "|", formatter("Col Pct"), "|\n", 104 | "|---------------|\n\n", 105 | "Total Observations: ", nrow(data), "\n\n" 106 | ) 107 | 108 | for (i in seq_len(n)) { 109 | k <- cross_table2(plot_data[[factor_start[, i][1]]], plot_data[[factor_start[, i][2]]], 110 | factor_start[, i][1], factor_start[, i][2]) 111 | print(k) 112 | } 113 | } 114 | 115 | #' @export 116 | #' @rdname ds_auto_freq_table 117 | #' @usage NULL 118 | #' 119 | ds_tway_tables <- function(data) { 120 | .Deprecated("ds_auto_cross_table()") 121 | ds_auto_cross_table(data) 122 | } 123 | 124 | #' @export 125 | #' @rdname ds_auto_freq_table 126 | #' @usage NULL 127 | #' 128 | ds_oway_tables <- function(data) { 129 | .Deprecated("ds_auto_freq_table()") 130 | ds_auto_freq_table(data) 131 | } 132 | -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.11.0 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2020 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Headroom=n()}(this,function(){"use strict";function t(){return"undefined"!=typeof window}function d(t){return function(t){return t&&t.document&&function(t){return 9===t.nodeType}(t.document)}(t)?function(t){var n=t.document,o=n.body,s=n.documentElement;return{scrollHeight:function(){return Math.max(o.scrollHeight,s.scrollHeight,o.offsetHeight,s.offsetHeight,o.clientHeight,s.clientHeight)},height:function(){return t.innerHeight||s.clientHeight||o.clientHeight},scrollY:function(){return void 0!==t.pageYOffset?t.pageYOffset:(s||o.parentNode||o).scrollTop}}}(t):function(t){return{scrollHeight:function(){return Math.max(t.scrollHeight,t.offsetHeight,t.clientHeight)},height:function(){return Math.max(t.offsetHeight,t.clientHeight)},scrollY:function(){return t.scrollTop}}}(t)}function n(t,s,e){var n,o=function(){var n=!1;try{var t={get passive(){n=!0}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){n=!1}return n}(),i=!1,r=d(t),l=r.scrollY(),a={};function c(){var t=Math.round(r.scrollY()),n=r.height(),o=r.scrollHeight();a.scrollY=t,a.lastScrollY=l,a.direction=ls.tolerance[a.direction],e(a),l=t,i=!1}function h(){i||(i=!0,n=requestAnimationFrame(c))}var u=!!o&&{passive:!0,capture:!1};return t.addEventListener("scroll",h,u),c(),{destroy:function(){cancelAnimationFrame(n),t.removeEventListener("scroll",h,u)}}}function o(t,n){n=n||{},Object.assign(this,o.options,n),this.classes=Object.assign({},o.options.classes,n.classes),this.elem=t,this.tolerance=function(t){return t===Object(t)?t:{down:t,up:t}}(this.tolerance),this.initialised=!1,this.frozen=!1}return o.prototype={constructor:o,init:function(){return o.cutsTheMustard&&!this.initialised&&(this.addClass("initial"),this.initialised=!0,setTimeout(function(t){t.scrollTracker=n(t.scroller,{offset:t.offset,tolerance:t.tolerance},t.update.bind(t))},100,this)),this},destroy:function(){this.initialised=!1,Object.keys(this.classes).forEach(this.removeClass,this),this.scrollTracker.destroy()},unpin:function(){!this.hasClass("pinned")&&this.hasClass("unpinned")||(this.addClass("unpinned"),this.removeClass("pinned"),this.onUnpin&&this.onUnpin.call(this))},pin:function(){this.hasClass("unpinned")&&(this.addClass("pinned"),this.removeClass("unpinned"),this.onPin&&this.onPin.call(this))},freeze:function(){this.frozen=!0,this.addClass("frozen")},unfreeze:function(){this.frozen=!1,this.removeClass("frozen")},top:function(){this.hasClass("top")||(this.addClass("top"),this.removeClass("notTop"),this.onTop&&this.onTop.call(this))},notTop:function(){this.hasClass("notTop")||(this.addClass("notTop"),this.removeClass("top"),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){this.hasClass("bottom")||(this.addClass("bottom"),this.removeClass("notBottom"),this.onBottom&&this.onBottom.call(this))},notBottom:function(){this.hasClass("notBottom")||(this.addClass("notBottom"),this.removeClass("bottom"),this.onNotBottom&&this.onNotBottom.call(this))},shouldUnpin:function(t){return"down"===t.direction&&!t.top&&t.toleranceExceeded},shouldPin:function(t){return"up"===t.direction&&t.toleranceExceeded||t.top},addClass:function(t){this.elem.classList.add.apply(this.elem.classList,this.classes[t].split(" "))},removeClass:function(t){this.elem.classList.remove.apply(this.elem.classList,this.classes[t].split(" "))},hasClass:function(t){return this.classes[t].split(" ").every(function(t){return this.classList.contains(t)},this.elem)},update:function(t){t.isOutOfBounds||!0!==this.frozen&&(t.top?this.top():this.notTop(),t.bottom?this.bottom():this.notBottom(),this.shouldUnpin(t)?this.unpin():this.shouldPin(t)&&this.pin())}},o.options={tolerance:{up:0,down:0},offset:0,scroller:t()?window:null,classes:{frozen:"headroom--frozen",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},o.cutsTheMustard=!!(t()&&function(){}.bind&&"classList"in document.documentElement&&Object.assign&&Object.keys&&requestAnimationFrame),o}); -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | Articles • descriptr 3 | Skip to contents 4 | 5 | 6 |
    36 |
    37 |
    41 | 42 |
    43 |

    All vignettes

    44 |
    45 | 46 |
    Categorical Data
    47 |
    48 |
    Continuous Data
    49 |
    50 |
    Visualization
    51 |
    52 |
    53 |
    54 | 55 | 56 |
    65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | --------------------------------------------------------------------------------