├── .DS_Store ├── .Rbuildignore ├── .github ├── .gitignore └── workflows │ ├── R-CMD-check.yaml │ └── pkgdown.yaml ├── .gitignore ├── DESCRIPTION ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── calculate_share_non_row_wise.R ├── calculate_share_row_wise.R ├── globals.R ├── helper.R ├── overview_add_na_output.R ├── overview_crossplot.R ├── overview_crosstab.R ├── overview_heat.R ├── overview_latex.R ├── overview_na.R ├── overview_overlap.R ├── overview_plot.R ├── overview_plot_absolute.R ├── overview_plot_percentage.R ├── overview_tab.R ├── overview_tab_df.R ├── overview_tab_dt.R ├── private_overview_heat.R ├── private_overview_tab.R ├── theme_heat_plot.R ├── theme_na_plot.R └── toydata.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── codecov.yml ├── cran-comments.md ├── data └── toydata.RData ├── docs ├── 404.html ├── LICENSE.html ├── apple-touch-icon-120x120.png ├── apple-touch-icon-152x152.png ├── apple-touch-icon-180x180.png ├── apple-touch-icon-60x60.png ├── apple-touch-icon-76x76.png ├── apple-touch-icon.png ├── articles │ ├── ex1.png │ ├── ex2.png │ ├── ex3.png │ ├── extension1.png │ ├── index.html │ ├── overviewR_vignette.html │ └── overviewR_vignette_files │ │ ├── figure-html │ │ ├── unnamed-chunk-19-1.png │ │ ├── unnamed-chunk-20-1.png │ │ ├── unnamed-chunk-21-1.png │ │ ├── unnamed-chunk-22-1.png │ │ ├── unnamed-chunk-24-1.png │ │ ├── unnamed-chunk-26-1.png │ │ ├── unnamed-chunk-27-1.png │ │ ├── unnamed-chunk-31-1.png │ │ ├── unnamed-chunk-32-1.png │ │ └── unnamed-chunk-33-1.png │ │ └── header-attrs-2.7 │ │ └── header-attrs.js ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── dev │ ├── 404.html │ ├── LICENSE.html │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── articles │ │ ├── ex1.png │ │ ├── ex2.png │ │ ├── ex3.png │ │ ├── extension1.png │ │ ├── getting-started.html │ │ ├── getting-started_files │ │ │ └── header-attrs-2.7 │ │ │ │ └── header-attrs.js │ │ ├── index.html │ │ ├── overviewR_vignette.html │ │ └── overviewR_vignette_files │ │ │ ├── figure-html │ │ │ ├── unnamed-chunk-19-1.png │ │ │ ├── unnamed-chunk-20-1.png │ │ │ ├── unnamed-chunk-21-1.png │ │ │ ├── unnamed-chunk-23-1.png │ │ │ ├── unnamed-chunk-25-1.png │ │ │ ├── unnamed-chunk-27-1.png │ │ │ ├── unnamed-chunk-28-1.png │ │ │ ├── unnamed-chunk-29-1.png │ │ │ ├── unnamed-chunk-30-1.png │ │ │ ├── unnamed-chunk-31-1.png │ │ │ ├── unnamed-chunk-32-1.png │ │ │ ├── unnamed-chunk-33-1.png │ │ │ └── unnamed-chunk-38-1.png │ │ │ └── header-attrs-2.7 │ │ │ └── header-attrs.js │ ├── authors.html │ ├── bootstrap-toc.css │ ├── bootstrap-toc.js │ ├── docsearch.css │ ├── docsearch.js │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── index.html │ ├── link.svg │ ├── logo.png │ ├── news │ │ └── index.html │ ├── pkgdown.css │ ├── pkgdown.js │ ├── pkgdown.yml │ └── reference │ │ ├── Rplot001.png │ │ ├── figures │ │ ├── CheatSheet_overviewR.pdf │ │ ├── bar.png │ │ ├── dot.png │ │ ├── ex1.png │ │ ├── ex2.png │ │ ├── ex3.png │ │ ├── extension1.png │ │ ├── logo.png │ │ ├── unnamed-chunk-19-1.png │ │ ├── unnamed-chunk-20-1.png │ │ ├── unnamed-chunk-21-1.png │ │ ├── unnamed-chunk-22-1.png │ │ ├── unnamed-chunk-23-1.png │ │ ├── unnamed-chunk-24-1.png │ │ ├── unnamed-chunk-25-1.png │ │ ├── unnamed-chunk-26-1.png │ │ ├── unnamed-chunk-27-1.png │ │ ├── unnamed-chunk-28-1.png │ │ ├── unnamed-chunk-29-1.png │ │ ├── unnamed-chunk-30-1.png │ │ ├── unnamed-chunk-31-1.png │ │ ├── unnamed-chunk-32-1.png │ │ ├── unnamed-chunk-33-1.png │ │ ├── unnamed-chunk-34-1.png │ │ ├── unnamed-chunk-35-1.png │ │ ├── unnamed-chunk-36-1.png │ │ ├── unnamed-chunk-37-1.png │ │ └── venn.png │ │ ├── index.html │ │ ├── overview_crossplot-1.png │ │ ├── overview_crossplot.html │ │ ├── overview_crosstab.html │ │ ├── overview_heat-1.png │ │ ├── overview_heat.html │ │ ├── overview_na-1.png │ │ ├── overview_na.html │ │ ├── overview_overlap.html │ │ ├── overview_plot-1.png │ │ ├── overview_plot.html │ │ ├── overview_print.html │ │ ├── overview_tab.html │ │ └── toydata.html ├── docsearch.css ├── docsearch.js ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── index.html ├── link.svg ├── logo.png ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml └── reference │ ├── Rplot001.png │ ├── figures │ ├── CheatSheet_overviewR.pdf │ ├── ex1.png │ ├── ex2.png │ ├── ex3.png │ ├── extension1.png │ ├── logo.png │ ├── unnamed-chunk-19-1.png │ ├── unnamed-chunk-20-1.png │ ├── unnamed-chunk-21-1.png │ ├── unnamed-chunk-22-1.png │ ├── unnamed-chunk-23-1.png │ ├── unnamed-chunk-24-1.png │ ├── unnamed-chunk-25-1.png │ ├── unnamed-chunk-26-1.png │ ├── unnamed-chunk-27-1.png │ ├── unnamed-chunk-28-1.png │ ├── unnamed-chunk-30-1.png │ ├── unnamed-chunk-31-1.png │ ├── unnamed-chunk-32-1.png │ ├── unnamed-chunk-33-1.png │ └── unnamed-chunk-34-1.png │ ├── index.html │ ├── overview_crossplot-1.png │ ├── overview_crossplot.html │ ├── overview_crosstab.html │ ├── overview_heat-1.png │ ├── overview_heat.html │ ├── overview_na-1.png │ ├── overview_na.html │ ├── overview_plot-1.png │ ├── overview_plot.html │ ├── overview_print.html │ ├── overview_tab.html │ └── toydata.html ├── index.md ├── man ├── .DS_Store ├── calculate_share_non_row_wise.Rd ├── calculate_share_row_wise.Rd ├── dot-overview_heat.Rd ├── dot-overview_tab.Rd ├── figures │ ├── CheatSheet_overviewR.pdf │ ├── bar.png │ ├── dot.png │ ├── ex1.png │ ├── ex2.png │ ├── ex3.png │ ├── extension1.png │ ├── logo.png │ ├── unnamed-chunk-19-1.png │ ├── unnamed-chunk-20-1.png │ ├── unnamed-chunk-21-1.png │ ├── unnamed-chunk-22-1.png │ ├── unnamed-chunk-23-1.png │ ├── unnamed-chunk-24-1.png │ ├── unnamed-chunk-25-1.png │ ├── unnamed-chunk-26-1.png │ ├── unnamed-chunk-27-1.png │ ├── unnamed-chunk-28-1.png │ ├── unnamed-chunk-29-1.png │ ├── unnamed-chunk-30-1.png │ ├── unnamed-chunk-31-1.png │ ├── unnamed-chunk-32-1.png │ ├── unnamed-chunk-33-1.png │ ├── unnamed-chunk-34-1.png │ ├── unnamed-chunk-35-1.png │ ├── unnamed-chunk-36-1.png │ ├── unnamed-chunk-37-1.png │ ├── unnamed-chunk-38-1.png │ ├── unnamed-chunk-39-1.png │ └── venn.png ├── find_int_runs.Rd ├── overview_add_na_output.Rd ├── overview_crossplot.Rd ├── overview_crosstab.Rd ├── overview_heat.Rd ├── overview_latex.Rd ├── overview_na.Rd ├── overview_overlap.Rd ├── overview_plot.Rd ├── overview_plot_absolute.Rd ├── overview_plot_percentage.Rd ├── overview_tab.Rd ├── overview_tab_df.Rd ├── overview_tab_dt.Rd ├── theme_heat_plot.Rd ├── theme_na_plot.Rd └── toydata.Rd ├── overviewR.Rproj ├── pkgdown └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── tests ├── testthat.R └── testthat │ ├── test-check_output.R │ └── test-dt_output.R └── vignettes ├── ex1.png ├── ex2.png ├── ex3.png ├── extension1.png ├── getting-started.Rmd ├── overviewR_vignette.Rmd ├── unnamed-chunk-22-1.png ├── unnamed-chunk-23-1.png ├── unnamed-chunk-24-1.png ├── unnamed-chunk-25-1.png ├── unnamed-chunk-27-1.png └── unnamed-chunk-28-1.png /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/.DS_Store -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.gitlab-ci\.yml$ 4 | ^\.circleci$ 5 | ^\.circleci/config\.yml$ 6 | ^\.github$ 7 | ^codecov\.yml$ 8 | ^revdep$ 9 | ^cran-comments\.md$ 10 | ^CRAN-RELEASE$ 11 | ^docs$ 12 | ^pkgdown$ 13 | ^index\.md$ 14 | ^_pkgdown\.yaml$ 15 | ^_pkgdown\.yml$ 16 | ^README\.Rmd$ 17 | ^LICENSE\.md$ 18 | ^doc$ 19 | ^Meta$ 20 | ^CRAN-SUBMISSION$ 21 | ^paper/ 22 | ^cran-comments\.md$ 23 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. 2 | # https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | pull_request: 9 | branches: 10 | - main 11 | - master 12 | 13 | name: R-CMD-check 14 | 15 | jobs: 16 | R-CMD-check: 17 | runs-on: ${{ matrix.config.os }} 18 | 19 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 20 | 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | config: 25 | - {os: windows-latest, r: 'release'} 26 | - {os: macOS-latest, r: 'release'} 27 | - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} 28 | - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} 29 | 30 | env: 31 | R_REMOTES_NO_ERRORS_FROM_WARNINGS: true 32 | RSPM: ${{ matrix.config.rspm }} 33 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 34 | 35 | steps: 36 | - uses: actions/checkout@v2 37 | 38 | - uses: r-lib/actions/setup-r@v1 39 | with: 40 | r-version: ${{ matrix.config.r }} 41 | 42 | - uses: r-lib/actions/setup-pandoc@v1 43 | 44 | - name: Query dependencies 45 | run: | 46 | install.packages('remotes') 47 | saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) 48 | writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") 49 | shell: Rscript {0} 50 | 51 | - name: Cache R packages 52 | if: runner.os != 'Windows' 53 | uses: actions/cache@v2 54 | with: 55 | path: ${{ env.R_LIBS_USER }} 56 | key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} 57 | restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- 58 | 59 | - name: Install system dependencies 60 | if: runner.os == 'Linux' 61 | run: | 62 | while read -r cmd 63 | do 64 | eval sudo $cmd 65 | done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') 66 | 67 | - name: Install dependencies 68 | run: | 69 | remotes::install_deps(dependencies = TRUE) 70 | remotes::install_cran("rcmdcheck") 71 | shell: Rscript {0} 72 | 73 | - name: Check 74 | env: 75 | _R_CHECK_CRAN_INCOMING_REMOTE_: false 76 | run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") 77 | shell: Rscript {0} 78 | 79 | - name: Upload check results 80 | if: failure() 81 | uses: actions/upload-artifact@main 82 | with: 83 | name: ${{ runner.os }}-r${{ matrix.config.r }}-results 84 | path: check 85 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - main 5 | - master 6 | 7 | name: pkgdown 8 | 9 | jobs: 10 | pkgdown: 11 | runs-on: macOS-latest 12 | env: 13 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: r-lib/actions/setup-r@v1 17 | - uses: r-lib/actions/setup-pandoc@v1 18 | - name: Query dependencies 19 | run: | 20 | install.packages('remotes') 21 | saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) 22 | writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") 23 | shell: Rscript {0} 24 | 25 | - name: Cache R packages 26 | uses: actions/cache@v2 27 | with: 28 | path: ${{ env.R_LIBS_USER }} 29 | key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} 30 | restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- 31 | 32 | - name: Install dependencies 33 | run: | 34 | remotes::install_deps(dependencies = TRUE) 35 | install.packages("pkgdown") 36 | remotes::install_github("amirmasoudabdol/preferably") 37 | shell: Rscript {0} 38 | 39 | - name: Install package 40 | run: R CMD INSTALL . 41 | 42 | 43 | - name: Install package 44 | run: R CMD INSTALL . 45 | 46 | - name: Deploy package 47 | run: | 48 | git config --local user.email "actions@github.com" 49 | git config --local user.name "GitHub Actions" 50 | Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Standard 2 | .Rproj.user 3 | .DS_Store 4 | .DS_Store? 5 | 6 | # History files 7 | 8 | .Rhistory 9 | 10 | .Rapp.history 11 | 12 | # Session Data files 13 | 14 | .RData 15 | 16 | # User-specific files 17 | 18 | .Ruserdata 19 | 20 | 21 | # Example code in package build process 22 | 23 | *-Ex.R 24 | 25 | # Output files from R CMD build 26 | 27 | /*.tar.gz 28 | 29 | # Output files from R CMD check 30 | 31 | /*.Rcheck/ 32 | 33 | # RStudio files 34 | 35 | .Rproj.user/ 36 | 37 | # produced vignettes 38 | 39 | vignettes/*.html 40 | 41 | vignettes/*.pdf 42 | 43 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 44 | 45 | .httr-oauth 46 | 47 | # knitr and R markdown default cache directories 48 | 49 | *_cache/ 50 | 51 | /cache/ 52 | 53 | # Temporary files created by R markdown 54 | 55 | *.utf8.md 56 | 57 | *.knit.md 58 | 59 | # R Environment Variables 60 | 61 | .Renviron 62 | 63 | doc 64 | Meta 65 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Type: Package 2 | Package: overviewR 3 | Title: Easily Extracting Information About Your Data 4 | Version: 0.0.13 5 | Authors@R: c( 6 | person("Cosima", "Meyer", , "cosima.meyer@gmail.com", role = c("cre", "aut")), 7 | person("Dennis", "Hammerschmidt", , "dennis_hammerschmidt@yahoo.com", role = "aut") 8 | ) 9 | Description: Makes it easy to display descriptive information on a data 10 | set. Getting an easy overview of a data set by displaying and 11 | visualizing sample information in different tables (e.g., time and 12 | scope conditions). The package also provides publishable 'LaTeX' code 13 | to present the sample information. 14 | License: GPL-3 15 | URL: https://github.com/cosimameyer/overviewR 16 | BugReports: https://github.com/cosimameyer/overviewR/issues 17 | Depends: 18 | R (>= 3.5.0) 19 | Imports: 20 | data.table (>= 1.14.2), 21 | dplyr (>= 1.0.0), 22 | ggplot2 (>= 3.3.2), 23 | ggrepel (>= 0.8.2), 24 | ggvenn (>= 0.1.8), 25 | rlang, 26 | tibble (>= 3.0.1), 27 | tidyr 28 | Suggests: 29 | countrycode, 30 | covr, 31 | devtools, 32 | knitr, 33 | magrittr, 34 | pkgdown, 35 | rmarkdown, 36 | spelling, 37 | testthat, 38 | xtable 39 | VignetteBuilder: 40 | knitr, 41 | rmarkdown 42 | Encoding: UTF-8 43 | Language: en-US 44 | LazyData: true 45 | RoxygenNote: 7.2.3 46 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(overview_crossplot) 4 | export(overview_crosstab) 5 | export(overview_heat) 6 | export(overview_latex) 7 | export(overview_na) 8 | export(overview_overlap) 9 | export(overview_plot) 10 | export(overview_tab) 11 | importFrom(data.table,data.table) 12 | importFrom(dplyr,"%>%") 13 | importFrom(ggplot2,ggplot) 14 | importFrom(ggrepel,geom_text_repel) 15 | importFrom(ggvenn,ggvenn) 16 | importFrom(rlang,":=") 17 | importFrom(stats,reorder) 18 | importFrom(tibble,"rownames_to_column") 19 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | ## overviewR 0.0.13 2 | 3 | - Updates in `overview_overlap()` to comply with recent changes in dplyr v1.1.0 4 | 5 | ## overviewR 0.0.12 6 | 7 | - Following issue #24's excellent suggestion, we renamed `overview_print` to `overview_latex` (old code with `overview_print` still works but it is recommended to use `overview_latex` instead) 8 | - Following issue #29's advice, we also deprecated the single argument `file` and `path` in `overview_latex` and added a new argument `file_path` 9 | 10 | --- 11 | 12 | ## overviewR 0.0.11 13 | 14 | - CRAN resubmission to fix bug in `overview_overlap` which did not return the correct percentages in the visualization 15 | 16 | --- 17 | 18 | ## overviewR 0.0.10 19 | 20 | - CRAN resubmission 21 | We fixed the following bugs and issues: 22 | - Fixed bug in `overview_tab` function 23 | - Internal function returned an integer instead of a date when using multiple time options (also updated the vignettes) 24 | - Fixed bug in vignette 25 | - "Having package code which is run as part of the checks and attempts to write to the user library violates the CRAN Policy's" 26 | - "Packages should not write in the user’s home filespace (including 27 | clipboards), nor anywhere else on the file system apart from the R 28 | session’s temporary directory (or during installation in the location 29 | pointed to by TMPDIR: and such usage should be cleaned up)." 30 | - Increased the code coverage of units tests to 100% 31 | 32 | --- 33 | 34 | ## overviewR 0.0.9 35 | 36 | - This version adds the possibility to use multiple time arguments for `overview_tab` 37 | - It also adds an extended `toydata` data.frame (including variables for day) 38 | 39 | --- 40 | 41 | ## overviewR 0.0.8.999 42 | 43 | - This development version adds the possibility to use a data.table object with `overview_tab` and `overview_na` 44 | 45 | --- 46 | 47 | ## overviewR 0.0.7.999.1 48 | 49 | - This development version adds the following extensions 50 | - `overview_plot` 51 | - Adjustable `dot_size` (default is 2) 52 | - `overview_na` 53 | - Option to generate `row_wise` NA values 54 | - `overview_overlap` 55 | - New function to compare (at the moment) two data sets using bar graphs (`plot_type = "bar"`) or Venn diagrams (`plot_type = "venn"`) 56 | - `overview_print` 57 | - Fixed a small issue that can cause problems with large (and complex) TeX documents 58 | 59 | 60 | --- 61 | 62 | ## overviewR 0.0.7.999 63 | 64 | - This development version adds bugs fixes and extensions for 65 | - `overview_plot` 66 | - some consecutive years were not correctly connected before) 67 | - `color` argument to color parts of the time lines 68 | - `overview_print` 69 | - `label` to add a cross-reference label 70 | - `fontsize` to change the font size 71 | - `overview_crossplot` 72 | - a new function that visualizes basically the same output as `overview_crosstab` 73 | - `overview_tab` 74 | - if there is a `NA` in the `id` variable this observation will be automatically deleted. The user receives a warning. 75 | - `overview_crosstab` 76 | - if there is a `NA` in the `id` variable this observation will be automatically deleted. The user receives a warning. 77 | 78 | 79 | --- 80 | 81 | ## overviewR 0.0.7 82 | 83 | - CRAN resubmission 84 | We fixed the following bugs: 85 | - Fixed bug in overview_plot function 86 | - Time line was not correctly displayed when a consecutive time variable was present for two different id variables 87 | - Fixed bug in vignette 88 | - Loaded package dplyr to follow CRAN policies: "Packages which use Internet resources should fail gracefully with an informative message if the resource is not available or has changed (and not give a check warning nor error). CRAN versions of packages should work with the current CRAN and Bioconductor releases of packages they depend on and not anticipate nor recommend development versions of such packages (or themselves) on other repositories." 89 | 90 | And added the following new features: 91 | - Added function for overview_plot function 92 | - Y axis is now automatically ordered in ascending order 93 | - Extended the overview_heat function 94 | - Y axis is now automatically ordered in ascending order 95 | - Introduced "label" argument to overview_heat that allows the user to select whether the percentage/total number of observations should be displayed or not 96 | 97 | --- 98 | 99 | ## overviewR 0.0.6 100 | 101 | - CRAN resubmission 102 | - Added new functions: 103 | - overview_plot 104 | - overview_na 105 | - overview_heat 106 | - Fixed two bugs in overview_plot and overview_tab that returned erroneous results on non-sorted data 107 | 108 | --- 109 | 110 | ## overviewR 0.0.5.900 111 | 112 | - This development version adds the following functions: 113 | - overview_plot 114 | - overview_na 115 | - overview_heat 116 | 117 | --- 118 | 119 | ## overviewR 0.0.4 120 | 121 | - CRAN release 122 | - Further adjustments to new CRAN comments to avoid writing on the user's home file space 123 | 124 | --- 125 | 126 | ## overviewR 0.0.3 127 | 128 | - Adjusted examples and tests based on CRAN's standards 129 | 130 | --- 131 | 132 | ## overviewR 0.0.2 133 | 134 | - Bug fixes in overview_tab that affected overview_crosstab 135 | 136 | --- 137 | 138 | ## overviewR 0.0.1 139 | 140 | -------------------------------------------------------------------------------- /R/calculate_share_non_row_wise.R: -------------------------------------------------------------------------------- 1 | #' @title calculate_share_non_row_wise 2 | #' 3 | #' @description Function used in `overview_na` to calculate the column-wise share of NA 4 | #' 5 | #' @param dat Data frame 6 | #' @return The function returns a data set that has the information 7 | #' on the column-wise NA share 8 | #' 9 | calculate_share_non_row_wise <- function(dat = NULL) { 10 | if (any(class(dat) == "data.table")) { 11 | # Generate necessary variables -------------------------------------------- 12 | na_count <- vapply(dat, function(y) { 13 | sum(length(which(is.na( 14 | y 15 | )))) 16 | }, FUN.VALUE = numeric(1)) 17 | total <- vapply(dat, function(y) { 18 | length(y) 19 | }, FUN.VALUE = numeric(1)) 20 | 21 | dat_result <- data.table(na_count, total) 22 | 23 | # Add rownames as variable 24 | dat_result <- 25 | data.table::setDT(dat_result, keep.rownames = "variable")[] 26 | 27 | # Get percentage 28 | dat_result <- dat_result[, list(percentage = na_count / (total / 100))] 29 | } else { 30 | # Generate necessary variables -------------------------------------------- 31 | na_count <- vapply(dat, function(y) { 32 | sum(length(which(is.na( 33 | y 34 | )))) 35 | }, FUN.VALUE = numeric(1)) 36 | total <- vapply(dat, function(y) { 37 | length(y) 38 | }, FUN.VALUE = numeric(1)) 39 | 40 | dat_result <- data.frame(na_count, total) 41 | # Add rownames as variable 42 | dat_result <- 43 | tibble::rownames_to_column(dat_result, var = "variable") 44 | # Get percentage 45 | dat_result <- dat_result %>% 46 | dplyr::mutate(percentage = na_count / (total / 100)) 47 | } 48 | return(dat_result) 49 | } 50 | -------------------------------------------------------------------------------- /R/calculate_share_row_wise.R: -------------------------------------------------------------------------------- 1 | #' @title calculate_share_row_wise 2 | #' 3 | #' @description Function used in `overview_na` to calculate the share of NA row-wise 4 | #' 5 | #' @param dat Data frame 6 | #' @return The function returns a data set that has the information 7 | #' on the row-wise NA share 8 | 9 | calculate_share_row_wise <- function(dat = NULL) { 10 | if (any(class(dat) == "data.table")) { 11 | dat <- data.table::copy(dat) 12 | dat_result <- 13 | dat[, list(na_count = rowSums(is.na(dat)), total = ncol(dat))][, .(na_count, total)] 14 | 15 | # Add rownames as variable and get the percentage 16 | dat_result <- 17 | dat_result[, list( 18 | na_count = 1:nrow(dat_result), 19 | percentage = na_count / (total / 100) 20 | )] 21 | } else { 22 | apply(dat, MARGIN = 1, function(x) { 23 | sum(is.na(x)) 24 | }) 25 | 26 | dat_result <- dat %>% 27 | dplyr::rowwise() %>% 28 | dplyr::summarise(dplyr::across(dplyr::everything(), list(~ sum(is.na( 29 | . 30 | ))))) %>% 31 | dplyr::mutate( 32 | na_count = rowSums(.), 33 | total = length(colnames(.)) 34 | ) %>% 35 | dplyr::select(na_count, total) 36 | 37 | # Add rownames as variable 38 | dat_result$variable <- 1:nrow(dat_result) 39 | 40 | # Get percentage 41 | dat_result <- dat_result %>% 42 | dplyr::mutate(percentage = na_count / (total / 100)) 43 | } 44 | return(dat_result) 45 | } 46 | -------------------------------------------------------------------------------- /R/globals.R: -------------------------------------------------------------------------------- 1 | utils::globalVariables( 2 | c( 3 | "c1", 4 | "c2", 5 | "time_frame", 6 | "toydata", 7 | "count", 8 | "value", 9 | "count2", 10 | "grp", 11 | "n", 12 | "percentage", 13 | "total", 14 | "variable", 15 | "idx", 16 | "text", 17 | "quart4", 18 | "quart3", 19 | "quart2", 20 | "quart1", 21 | ".", 22 | "na_count", 23 | "..col_names", 24 | "..return_cols" 25 | ) 26 | ) 27 | -------------------------------------------------------------------------------- /R/helper.R: -------------------------------------------------------------------------------- 1 | #' @title find_int_runs 2 | #' 3 | #' @description Function used in `overview_tab` to find running integers 4 | #' 5 | #' @param run Variable (integer) that should be checked for consecutive values 6 | #' @return The function returns a data set 7 | 8 | # Check for consecutive numbers and collapse them with "-" 9 | # Inspired here: https://bit.ly/3ebZo5j 10 | find_int_runs <- function(run = NULL) { 11 | rundiff <- c(1, diff(run)) 12 | difflist <- split(run, cumsum(rundiff != 1)) 13 | unlist(lapply(difflist, function(x) { 14 | if (length(x) %in% 1) { 15 | as.character(x) 16 | } else { 17 | paste(x[1], "-", x[length(x)]) 18 | } 19 | }), use.names = FALSE) 20 | } 21 | -------------------------------------------------------------------------------- /R/overview_add_na_output.R: -------------------------------------------------------------------------------- 1 | #' @title overview_add_na_output 2 | #' 3 | #' @description Function used in `overview_na` to generate a new data frame with 4 | #' na_count and percentage share of NAs for each row 5 | #' 6 | #' @param dat_result Data.frame from `overview_na` 7 | #' @param dat Data frame 8 | #' @return The function returns a data set that has the information 9 | #' on the row-wise NA share 10 | 11 | overview_add_na_output <- function(dat_result = NULL, dat = NULL) { 12 | if (any(class(dat) == "data.table")) { 13 | dat_result <- dat_result[, .(na_count, percentage)] 14 | dat_with_na <- cbind(dat, dat_result) 15 | return(dat_with_na) 16 | } else { 17 | dat_result <- dat_result %>% 18 | dplyr::select(na_count, percentage) 19 | dat_with_na <- cbind(dat, dat_result) 20 | return(dat_with_na) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /R/overview_heat.R: -------------------------------------------------------------------------------- 1 | #' @title overview_heat 2 | #' 3 | #' @description This function plots a heat map to visualize the 4 | #' coverage of the time-scope-units of the data. Options include total 5 | #' number of cases per time-scope-unit or relative number in percentage. 6 | #' @param dat The data set 7 | #' @param id The scope (e.g., country codes or individual IDs). The axis is 8 | #' ordered in ascending order by default. 9 | #' @param time The time (e.g., time periods given by years, months, ...) 10 | #' @param perc If FALSE (default) plot returns the total number of observations 11 | #' per time-scope-unit. If TRUE, it returns the number of observations per 12 | #' time-scope-unit in percentage 13 | #' @param exp_total Expected total number of observations (i.e. maximum) 14 | #' for time unit. 15 | #' @param xaxis Label of your x axis ("Time frame" is default) 16 | #' @param yaxis Label of your y axis ("Sample" is default) 17 | #' @param col_low Hex color code for the lowest value (default is "#dceaf2") 18 | #' @param col_high Hex color code for the lowest value (default is "#2A5773") 19 | #' @param label If TRUE (default), the total number of observations/percentages 20 | #' of observations are displayed. If FALSE, it returns no labels. 21 | #' @return A ggplot figure that presents sample coverage visually 22 | #' @examples 23 | #' data(toydata) 24 | #' overview_heat(toydata, ccode, year, perc = TRUE, exp_total = 12) 25 | #' @export 26 | #' @importFrom dplyr "%>%" 27 | #' @importFrom ggplot2 ggplot 28 | 29 | overview_heat <- 30 | function(dat, 31 | id, 32 | time, 33 | perc = FALSE, 34 | exp_total = NULL, 35 | xaxis = "Time frame", 36 | yaxis = "Sample", 37 | col_low = "#dceaf2", 38 | col_high = "#2A5773", 39 | label = TRUE) { 40 | 41 | # Set theme --------------------------------------------------------------- 42 | theme_plot <- theme_heat_plot() 43 | 44 | # Start with the data 45 | dat <- dat 46 | 47 | if (any(class(dat) == "data.table")) { 48 | id <- deparse(substitute(id)) 49 | time <- deparse(substitute(time)) 50 | col_names <- c(id, time) 51 | } else { 52 | id <- dplyr::enquo(id) 53 | time <- dplyr::enquo(time) 54 | } 55 | 56 | # Plot 57 | plot <- 58 | .overview_heat( 59 | dat = dat, 60 | id = id, 61 | time = time, 62 | label = label, 63 | perc = perc, 64 | col_low = col_low, 65 | col_high = col_high, 66 | xaxis = xaxis, 67 | yaxis = yaxis, 68 | theme_plot = theme_plot, 69 | exp_total = exp_total, 70 | col_names = col_names 71 | ) 72 | 73 | return(plot) 74 | } 75 | -------------------------------------------------------------------------------- /R/overview_latex.R: -------------------------------------------------------------------------------- 1 | #' @title overview_latex 2 | #' 3 | #' @description Produces a 'LaTeX' output for output obtained via 4 | #' \code{overview_tab} and \code{overview_crosstab} 5 | #' 6 | #' @param obj Overview object produced by overview_tab or overview_crosstab 7 | #' @param title Caption of the table (default is "Time and scope of the sample") 8 | #' @param id The name of the left column (default is "Sample"), will be ignored 9 | #' if crosstab is TRUE 10 | #' @param time The name of the right column (default is ("Time frame")), will 11 | #' be ignored if \code{crosstab} is TRUE 12 | #' @param crosstab Logical argument, if TRUE produces a \code{crosstab} output, 13 | #' default is FALSE 14 | #' @param cond1 Description for the first condition (character), will be 15 | #' ignored if \code{crosstab} is FALSE. This should correspond to the input 16 | #' for \code{cond1} in \code{overview_crosstab} 17 | #' @param cond2 Description for the second condition (character), will be 18 | #' ignored if \code{crosstab} is FALSE. This should correspond to the input 19 | #' for \code{cond2} in \code{overview_crosstab} 20 | #' @param save_out Optional argument, exports the output table as a .tex 21 | #' file, default is FALSE 22 | #' @param file_path Specifies the path and file name (.tex) where you store your output 23 | #' @param label Specifies the label (default is "tab:tab1") 24 | #' @param fontsize Specifies the font size (all 'LaTeX' font sizes such as 25 | #' "scriptsize" or "small" work) 26 | #' @param path This argument is deprecated. Please use "file_path" instead and add the full path. 27 | #' @param file This argument is deprecated. Please use "file_path" instead and add the full path. 28 | #' @return A 'LaTeX' output that can either be copy-pasted in a text document or 29 | #' exported directed as a .tex file 30 | #' @examples 31 | #' data(toydata) 32 | #' 33 | #' overview_object <- overview_tab(dat = toydata, id = ccode, time = year) 34 | #' overview_latex( 35 | #' obj = overview_object, 36 | #' title = "Some nice title", 37 | #' crosstab = FALSE 38 | #' ) 39 | #' 40 | #'#' overview_object <- overview_tab(dat = toydata, id = ccode, time = year) 41 | #' overview_latex( 42 | #' obj = overview_object, 43 | #' title = "Some nice title", 44 | #' file_path = "some/path_to/your_output_file.tex" 45 | #' ) 46 | #' 47 | #' overview_ct_object <- overview_crosstab( 48 | #' dat = toydata, 49 | #' cond1 = gdp, 50 | #' cond2 = population, 51 | #' threshold1 = 25000, 52 | #' threshold2 = 27000, 53 | #' id = ccode, 54 | #' time = year 55 | #' ) 56 | #' overview_latex( 57 | #' obj = overview_ct_object, 58 | #' title = "Some nice title for a cross tab", 59 | #' crosstab = TRUE, 60 | #' cond1 = "Name of first condition", 61 | #' cond2 = "Name of second condition" 62 | #' ) 63 | #' @export overview_latex overview_latex 64 | #' @importFrom dplyr "%>%" 65 | 66 | 67 | overview_latex <- 68 | function(obj, 69 | title = "Time and scope of the sample", 70 | id = "Sample", 71 | time = "Time frame", 72 | crosstab = FALSE, 73 | cond1 = "Condition 1", 74 | cond2 = "Condition 2", 75 | save_out = FALSE, 76 | file_path, 77 | label = "tab:tab1", 78 | fontsize, 79 | file, 80 | path) { 81 | 82 | if (!missing("file") & !missing("path")){ 83 | warning("Argument deprecated, use 'file_path' instead. 84 | The parameter 'file' and 'path' are combined to become 'file_path'.") 85 | file_path <- paste0(path, file) 86 | } 87 | 88 | obj <- as.matrix(obj) 89 | 90 | # Add a fontsize (if defined) 91 | if (missing(fontsize) == FALSE) { 92 | fontsize_mod <- paste0("\\", fontsize) 93 | } else { 94 | fontsize_mod <- "" 95 | } 96 | 97 | if (ncol(obj) != 2) { 98 | stop( 99 | "Data frame requires two columns that represent the time and 100 | scope dimension of the data. A overview_tab or overview_crosstab 101 | object is required." 102 | ) 103 | } 104 | 105 | if (crosstab == FALSE) { 106 | if (nrow(obj) == 2) { 107 | warning( 108 | "Are you sure you want a table for time and scope conditions? For a 109 | crosstab, set option crosstab = TRUE" 110 | ) 111 | } 112 | for (i in length(obj)) { 113 | begin_tab <- 114 | paste0( 115 | "% Overview table generated in ", 116 | version[["version.string"]], 117 | " using overviewR \n", 118 | "% Table created on ", 119 | as.character(Sys.Date()), 120 | "\n", 121 | "\\begin{table}[ht] \n \\centering \n \\caption{", 122 | title, 123 | "} \n", 124 | "\\label{", 125 | label, 126 | "} \n", 127 | fontsize_mod, 128 | "\n", 129 | "\\begin{tabular}{ll} \n \\hline \n", 130 | id, 131 | " & ", 132 | time, 133 | " \\\\ \\hline \n" 134 | ) 135 | out <- paste0(obj[, 1], " & ", obj[, 2], " \\\\ \n") 136 | end_tab <- 137 | paste0("\\hline \n \\end{tabular} \n \\end{table} \n") 138 | if (save_out == FALSE) { 139 | cat(begin_tab, out, end_tab) 140 | } 141 | if (save_out == TRUE) { 142 | sink(file_path) 143 | cat(begin_tab, out, end_tab) 144 | sink() 145 | } 146 | } 147 | } 148 | if (crosstab == TRUE) { 149 | for (i in length(obj)) { 150 | begin_crosstab <- paste0( 151 | "% Overview table generated in ", 152 | version[["version.string"]], 153 | " using overviewR \n", 154 | "% Table created on ", 155 | as.character(Sys.Date()), 156 | "\n", 157 | "% Please add the following packages to your document preamble: \n", 158 | "% \\usepackage{multirow} \n", 159 | "% \\usepackage{tabularx} \n", 160 | "% \\newcolumntype{b}{X} \n", 161 | "% \\newcolumntype{s}{>{\\hsize=.5\\hsize}X} \n", 162 | "\\begin{table}[ht] \n", 163 | "\\caption{", 164 | title, 165 | "} \n", 166 | "\\label{", 167 | label, 168 | "} \n", 169 | fontsize_mod, 170 | "\n", 171 | "\\begin{tabularx}{\\textwidth}{ssbb} \n", 172 | "\\hline & & \\multicolumn{2}{c}{\\textbf{", 173 | cond1, 174 | "}} \\\\ \n", 175 | " & & \\textbf{Fulfilled} & \\textbf{Not fulfilled} \\\\ ", 176 | "\n \\hline \\\\ \n \\multirow{2}{*}{\\textbf{", 177 | cond2, 178 | "}} & \\textbf{Fulfilled} & \n" 179 | ) 180 | cross_out1 <- paste0(obj[1, 1], " & ", obj[1, 2], "\\\\ ") 181 | 182 | mid_crosstab <- 183 | paste0("\n \\\\ \\hline \\\\ \n & \\textbf{Not fulfilled} & ") 184 | 185 | cross_out2 <- paste0(obj[2, 1], " & ", obj[2, 2], "\\\\ ") 186 | 187 | end_crosstab <- 188 | paste0("\\hline \\\\ \n \\end{tabularx} \n \\end{table} \n") 189 | if (save_out == FALSE) { 190 | cat( 191 | begin_crosstab, 192 | cross_out1, 193 | mid_crosstab, 194 | cross_out2, 195 | end_crosstab 196 | ) 197 | } 198 | } 199 | if (save_out == TRUE) { 200 | sink(file_path) 201 | cat( 202 | begin_crosstab, 203 | cross_out1, 204 | mid_crosstab, 205 | cross_out2, 206 | end_crosstab 207 | ) 208 | sink() 209 | } 210 | } 211 | } 212 | 213 | overview_print <- overview_latex 214 | -------------------------------------------------------------------------------- /R/overview_na.R: -------------------------------------------------------------------------------- 1 | #' @title overview_na 2 | #' 3 | #' @description This function plots a ggplot to visualize the distribution of 4 | #' NAs across all variables in the data set. 5 | #' 6 | #' @param dat Your data set 7 | #' @param yaxis Label of your y axis ("Variables" is default) 8 | #' @param perc If TRUE (default) plot returns the number of NAs in percentage 9 | #' @param row_wise If TRUE (FALSE is default) plot return the number of NAs 10 | #' per row 11 | #' @param add If TRUE (FALSE is default) it generates a new data frame with 12 | #' na_count and percentage share of NAs for each row 13 | #' @return Depending on the selection, the function returns a ggplot figure that 14 | #' presents the distribution of NAs in the data set or adds the information 15 | #' on the row-wise NA share 16 | #' @examples 17 | #' data(toydata) 18 | #' overview_na(toydata, perc = FALSE) 19 | #' @export 20 | #' @importFrom dplyr "%>%" 21 | #' @importFrom tibble "rownames_to_column" 22 | #' @importFrom ggplot2 ggplot 23 | #' @importFrom stats reorder 24 | #' @importFrom data.table data.table 25 | 26 | overview_na <- function(dat, 27 | yaxis = "Variables", 28 | perc = TRUE, 29 | row_wise = FALSE, 30 | add = FALSE) { 31 | # Set theme --------------------------------------------------------------- 32 | # Create a theme for the plot 33 | theme_plot <- theme_na_plot() 34 | 35 | # Perform calculations ---------------------------------------------------- 36 | 37 | if(row_wise) { 38 | yaxis <- "Observations" 39 | } 40 | 41 | # Start with the data 42 | dat <- dat 43 | 44 | if (row_wise == FALSE) { 45 | # Calculate the share non_row_wise 46 | dat_result <- calculate_share_non_row_wise(dat = dat) 47 | 48 | # Percentage -------------------------------------------------------------- 49 | if (perc == TRUE) { 50 | plot_perc <- 51 | overview_plot_percentage( 52 | dat_result = dat_result, 53 | theme_plot = theme_plot, 54 | yaxis = yaxis, 55 | xaxis = "Number of NA (in %)" 56 | ) 57 | 58 | return(plot_perc) 59 | } else if (perc == FALSE) { 60 | # Absolute numbers -------------------------------------------------------- 61 | plot_absolute <- 62 | overview_plot_absolute( 63 | dat_result = dat_result, 64 | theme_plot = theme_plot, 65 | yaxis = yaxis, 66 | xaxis = "Number of NA (total)" 67 | ) 68 | 69 | return(plot_absolute) 70 | } 71 | } 72 | 73 | if (row_wise == TRUE) { 74 | # Calculate the share row_wise 75 | dat_result <- calculate_share_row_wise(dat = dat) 76 | 77 | # Absolute numbers -------------------------------------------------------- 78 | if (add == FALSE && perc == FALSE) { 79 | plot_absolute <- overview_plot_absolute( 80 | dat_result = dat_result, 81 | theme_plot = theme_plot, 82 | yaxis = yaxis, 83 | xaxis = "Number of NA (total)" 84 | ) 85 | 86 | return(plot_absolute) 87 | } 88 | 89 | # Percentage -------------------------------------------------------------- 90 | if (add == FALSE && perc == TRUE) { 91 | plot_perc <- overview_plot_percentage( 92 | dat_result = dat_result, 93 | theme_plot = theme_plot, 94 | yaxis = yaxis, 95 | xaxis = "Number of NA (in %)" 96 | ) 97 | return(plot_perc) 98 | } 99 | 100 | if (add == TRUE) { 101 | dat_with_na <- 102 | overview_add_na_output(dat_result = dat_result, dat = dat) 103 | return(dat_with_na) 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /R/overview_overlap.R: -------------------------------------------------------------------------------- 1 | #' @title overview_overlap 2 | #' 3 | #' @description Provides an overview of the overlap of two data sets. 4 | #' Cautionary note: This function is currently only preliminary workable 5 | #' and can only capture 2 data sets. We are working on an extension that 6 | #' allows to compare multiple data sets. 7 | #' 8 | #' @param dat1 A first data set object 9 | #' @param dat2 A second data set object 10 | #' @param dat1_id Scope (e.g., country codes or individual IDs) of dat1. 11 | #' It is important that both ID variables are exactly the same to generate 12 | #' the perfect match. 13 | #' @param dat2_id Scope (e.g., country codes or individual IDs) of dat2. 14 | #' It is important that both ID variables are exactly the same to generate 15 | #' the perfect match. 16 | #' @param dat1_name Name of dat1 ("Data set 1" is the default) 17 | #' @param dat2_name Name of dat2 ("Data set 2" is the default) 18 | #' @param plot_type Type of plot ("bar" and "venn" are the two options) "venn" 19 | #' relies on the ggvenn function 20 | #' @return A ggplot2 object (bar chart) that shows the overlap of two data sets. 21 | #' @examples 22 | #' \dontrun{ 23 | #' data(toydata) 24 | #' toydata2 <- toydata[which(toydata$year > 1992), ] 25 | #' overview_overlap( 26 | #' dat1 = toydata, dat2 = toydata2, dat1_id = ccode, 27 | #' dat2_id = ccode 28 | #' ) 29 | #' } 30 | #' @export 31 | #' @importFrom dplyr "%>%" 32 | #' @importFrom ggplot2 ggplot 33 | #' @importFrom ggvenn ggvenn 34 | 35 | overview_overlap <- 36 | function(dat1, 37 | dat2, 38 | dat1_id, 39 | dat2_id, 40 | dat1_name = "Data set 1", 41 | dat2_name = "Data set 2", 42 | plot_type = "bar") { 43 | dat1 <- dat1 44 | dat2 <- dat2 45 | dat1_id <- dplyr::enquo(dat1_id) 46 | dat2_id <- dplyr::enquo(dat2_id) 47 | 48 | if (plot_type == "bar") { 49 | dat1_final <- dat1 %>% 50 | # Subset it to the ID 51 | dplyr::select(!!dat1_id) %>% 52 | # Group by ID 53 | dplyr::group_by(!!dat1_id) %>% 54 | # Count occurences of each ID 55 | dplyr::count() %>% 56 | # Rename the count variable 57 | dplyr::rename(count = n) 58 | 59 | dat2_final <- dat2 %>% 60 | # Subset it to the ID 61 | dplyr::select(!!dat2_id) %>% 62 | # Group by ID 63 | dplyr::group_by(!!dat2_id) %>% 64 | # Count occurences of each ID 65 | dplyr::count() %>% 66 | # Rename the count variable 67 | dplyr::rename(count2 = n) 68 | 69 | # Merge both data sets to get a better idea of the overlap 70 | subset <- 71 | # Join both data sets 72 | dplyr::full_join(x = dat1_final, y = dat2_final) 73 | 74 | # Plot it 75 | plot <- subset %>% 76 | tidyr::pivot_longer(count:count2, names_to = "count") %>% 77 | dplyr::group_by(!!dat1_id) %>% 78 | ggplot2::ggplot(ggplot2::aes( 79 | x = !!dat1_id, 80 | y = value, 81 | fill = count 82 | )) + 83 | ggplot2::geom_bar( 84 | stat = "identity", 85 | width = .5, 86 | position = "dodge" 87 | ) + 88 | ggplot2::scale_fill_grey( 89 | name = "Data set", 90 | breaks = c("count", "count2"), 91 | labels = c(dat1_name, dat2_name) 92 | ) + 93 | ggplot2::theme_classic() + 94 | ggplot2::xlab("Identifier") + 95 | ggplot2::ylab("Count (absolute number of observations)") + 96 | ggplot2::ggtitle("Overlap of data sets") 97 | 98 | # Return plot 99 | return(plot) 100 | } 101 | if (plot_type == "venn") { 102 | # Subset the id to a vector 103 | dat1_sub <- dplyr::select(dat1, !!dat1_id) %>% 104 | unlist() %>% 105 | as.vector() 106 | dat2_sub <- dplyr::select(dat2, !!dat2_id) %>% 107 | unlist() %>% 108 | as.vector() 109 | 110 | # Generate a list 111 | x <- list( 112 | `Data set 1` = dat1_sub, 113 | `Data set 2` = dat2_sub 114 | ) 115 | 116 | # Plot list 117 | plot <- ggvenn::ggvenn( 118 | x, 119 | fill_color = c("#dceaf2", "#2A5773"), 120 | stroke_size = 0.5, 121 | set_name_size = 5 122 | ) 123 | return(plot) 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /R/overview_plot.R: -------------------------------------------------------------------------------- 1 | #' @title overview_plot 2 | #' 3 | #' @description This function plots a ggplot to visualize the distribution of 4 | #' scope objects across the time frame. 5 | #' 6 | #' @param dat Your data set 7 | #' @param id Your scope (e.g., country codes or individual IDs). If the id 8 | #' variable contains NAs, they will not be included in the plot. 9 | #' @param time Your time (e.g., time periods given by years, months, ...) 10 | #' @param xaxis Label of the x axis ("Time frame" is default) 11 | #' @param yaxis Label of the y axis ("Sample" is default) 12 | #' @param asc Sorting the y axis in ascending order ("TRUE" is default) 13 | #' @param color Optional argument that defines the color 14 | #' @param dot_size Option argument that defines the dot size (default is 2) 15 | #' @return A ggplot figure that presents the sample information visually 16 | #' @examples 17 | #' data(toydata) 18 | #' overview_plot(dat = toydata, id = ccode, time = year) 19 | #' @export 20 | #' @importFrom dplyr "%>%" 21 | #' @importFrom ggplot2 ggplot 22 | 23 | overview_plot <- 24 | function(dat, 25 | id, 26 | time, 27 | xaxis = "Time frame", 28 | yaxis = "Sample", 29 | asc = TRUE, 30 | color, 31 | dot_size = 2) { 32 | # Create a theme for the plot 33 | theme_plot <- ggplot2::theme( 34 | # get rid of panel grids 35 | axis.line = ggplot2::element_blank(), 36 | axis.ticks.y = ggplot2::element_blank(), 37 | axis.ticks.x = ggplot2::element_blank(), 38 | panel.border = ggplot2::element_blank(), 39 | panel.grid.major.x = ggplot2::element_line( 40 | color = "grey90", 41 | linetype = "dashed" 42 | ), 43 | # Change plot and panel background 44 | plot.background = ggplot2::element_rect(fill = "white"), 45 | panel.background = ggplot2::element_rect(fill = "white"), 46 | # Change legend 47 | legend.direction = "horizontal", 48 | legend.position = "bottom", 49 | legend.background = ggplot2::element_rect(fill = "white", color = NA), 50 | legend.key = ggplot2::element_rect(color = "white", fill = "white"), 51 | legend.title = ggplot2::element_blank(), 52 | # Change text 53 | plot.caption = ggplot2::element_text(size = 5), 54 | axis.text = ggplot2::element_text( 55 | face = "plain", 56 | color = "black", 57 | size = 8 58 | ), 59 | text = ggplot2::element_text( 60 | size = 10, 61 | face = "plain" 62 | ) 63 | ) 64 | 65 | # First: Evaluate whether we have a color argument given or not 66 | if (missing(color) == TRUE) { 67 | # Start with the data 68 | dat <- dat 69 | id <- dplyr::enquo(id) 70 | time <- dplyr::enquo(time) 71 | 72 | # Reduce data frame to distinct values and drop if observations with NA 73 | # in the time variable and id variable 74 | # We further ungroup any grouping before continuing 75 | dat_red <- dat %>% 76 | dplyr::ungroup() %>% 77 | dplyr::distinct(!!id, !!time) %>% 78 | dplyr::filter(!is.na(!!id)) %>% 79 | dplyr::filter(!is.na(!!time)) %>% 80 | dplyr::arrange(!!id, !!time) 81 | # The following code is inspired by: https://bit.ly/2CpS3B7 82 | dat_red <- dat_red 83 | dat_red <- dat_red %>% 84 | dplyr::mutate(idx = c(1, diff(!!time))) 85 | i2 <- c(1, which(dat_red$idx != 1), nrow(dat_red) + 1) 86 | dat_red$grp <- rep(seq_len(length(diff(i2))), diff(i2)) 87 | 88 | # Adjust the plot where needed (trailing NA and leading NAs for instance) 89 | dat_red <- 90 | dat_red %>% dplyr::mutate( 91 | grp = ifelse(dplyr::lead(!!id) != 92 | !!id & 93 | dplyr::lead(idx) == 1, idx + 1, grp), 94 | grp = ifelse( 95 | is.na(grp) & 96 | dplyr::lag(!!id) == !!id & idx == 1, 97 | dplyr::lag(grp), 98 | grp 99 | ), 100 | grp = ifelse( 101 | is.na(grp) & 102 | !!id == dplyr::lead(!!id), 103 | dplyr::lag(grp), 104 | grp 105 | ) 106 | ) 107 | 108 | dat_red <- dat_red 109 | 110 | # Plot it 111 | if (asc == TRUE) { 112 | plot <- dat_red %>% 113 | dplyr::group_by(!!id) %>% 114 | ggplot2::ggplot(ggplot2::aes(x = factor(!!time), y = !!id)) + 115 | ggplot2::geom_line(size = 1.5, ggplot2::aes(group = grp)) + 116 | ggplot2::geom_point(pch = 15, size = dot_size) + 117 | # ggplot2::scale_color_manual(factor(!!color)) + 118 | ggplot2::ylab(yaxis) + 119 | ggplot2::xlab(xaxis) + 120 | ggplot2::scale_y_discrete(limits = rev) + 121 | theme_plot 122 | 123 | return(plot) 124 | } else { 125 | plot <- dat_red %>% 126 | dplyr::group_by(!!id) %>% 127 | ggplot2::ggplot(ggplot2::aes(x = factor(!!time), y = !!id)) + 128 | ggplot2::geom_line(size = 1.5, ggplot2::aes(group = grp)) + 129 | ggplot2::geom_point(pch = 15, size = 2) + 130 | # ggplot2::scale_color_manual() + 131 | ggplot2::ylab(yaxis) + 132 | ggplot2::xlab(xaxis) + 133 | theme_plot 134 | 135 | return(plot) 136 | } 137 | } else { 138 | # Start with the data 139 | dat <- dat 140 | id <- dplyr::enquo(id) 141 | time <- dplyr::enquo(time) 142 | color <- dplyr::enquo(color) 143 | 144 | # Reduce data frame to distinct values and drop if observations with NA 145 | # in the time variable and id variable 146 | # We further ungroup any grouping before continuing 147 | dat_red <- dat %>% 148 | dplyr::ungroup() %>% 149 | dplyr::distinct(!!id, !!time, !!color) %>% 150 | dplyr::filter(!is.na(!!id)) %>% 151 | dplyr::filter(!is.na(!!time)) %>% 152 | dplyr::arrange(!!id, !!time, !!color) 153 | # The following code is inspired by: https://bit.ly/2CpS3B7 154 | dat_red <- dat_red 155 | dat_red <- dat_red %>% 156 | dplyr::mutate(idx = c(1, diff(!!time))) 157 | i2 <- c(1, which(dat_red$idx != 1), nrow(dat_red) + 1) 158 | dat_red$grp <- rep(seq_len(length(diff(i2))), diff(i2)) 159 | 160 | # Adjust the plot where needed (trailing NA and leading NAs for instance) 161 | dat_red <- 162 | dat_red %>% dplyr::mutate( 163 | grp = ifelse(dplyr::lead(!!id) != 164 | !!id & 165 | dplyr::lead(idx) == 1, idx + 1, grp), 166 | grp = ifelse( 167 | is.na(grp) & 168 | dplyr::lag(!!id) == !!id & idx == 1, 169 | dplyr::lag(grp), 170 | grp 171 | ), 172 | grp = ifelse( 173 | is.na(grp) & 174 | !!id == dplyr::lead(!!id), 175 | dplyr::lag(grp), 176 | grp 177 | ) 178 | ) 179 | 180 | dat_red <- dat_red 181 | 182 | # Plot it 183 | if (asc == TRUE) { 184 | plot <- dat_red %>% 185 | dplyr::group_by(!!id) %>% 186 | ggplot2::ggplot(ggplot2::aes( 187 | x = factor(!!time), 188 | y = !!id, 189 | col = factor(!!color) 190 | )) + 191 | ggplot2::geom_line(size = 1.5, ggplot2::aes(group = grp)) + 192 | ggplot2::geom_point(pch = 15, size = dot_size) + 193 | ggplot2::ylab(yaxis) + 194 | ggplot2::xlab(xaxis) + 195 | ggplot2::scale_y_discrete(limits = rev) + 196 | theme_plot 197 | 198 | return(plot) 199 | } else { 200 | plot <- dat_red %>% 201 | dplyr::group_by(!!id) %>% 202 | ggplot2::ggplot(ggplot2::aes( 203 | x = factor(!!time), 204 | y = !!id, 205 | col = factor(!!color) 206 | )) + 207 | ggplot2::geom_line(size = 1.5, ggplot2::aes(group = grp)) + 208 | ggplot2::geom_point(pch = 15, size = 2) + 209 | ggplot2::ylab(yaxis) + 210 | ggplot2::xlab(xaxis) + 211 | theme_plot 212 | 213 | return(plot) 214 | } 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /R/overview_plot_absolute.R: -------------------------------------------------------------------------------- 1 | #' @title overview_plot_absolute 2 | #' 3 | #' @description Function used in `overview_na` to plot the absolute share of NA values 4 | #' 5 | #' @param dat_result Data frame 6 | #' @param theme_plot Theme for the plot (pre-defined) 7 | #' @param yaxis Name for yaxis 8 | #' @param xaxis Name for xaxix 9 | #' @return The function returns a ggplot 10 | #' 11 | overview_plot_absolute <- 12 | function(dat_result = NULL, 13 | theme_plot = NULL, 14 | yaxis = NULL, 15 | xaxis = NULL) { 16 | plot <- ggplot2::ggplot(data = dat_result) + 17 | ggplot2::geom_col(ggplot2::aes( 18 | y = reorder(variable, -na_count), 19 | x = na_count 20 | )) + 21 | ggplot2::ylab(yaxis) + 22 | ggplot2::xlab(xaxis) + 23 | theme_plot 24 | return(plot) 25 | } 26 | -------------------------------------------------------------------------------- /R/overview_plot_percentage.R: -------------------------------------------------------------------------------- 1 | #' @title overview_plot_percentage 2 | #' 3 | #' @description Function used in `overview_na` to plot the percentage share of NA values 4 | #' 5 | #' @param dat_result Data frame 6 | #' @param theme_plot Theme for the plot (pre-defined) 7 | #' @param yaxis Name for yaxis 8 | #' @param xaxis Name for xaxix 9 | #' @return The function returns a ggplot 10 | #' 11 | overview_plot_percentage <- 12 | function(dat_result = NULL, 13 | theme_plot = NULL, 14 | yaxis = NULL, 15 | xaxis = NULL) { 16 | plot <- ggplot2::ggplot(data = dat_result) + 17 | ggplot2::geom_col(ggplot2::aes( 18 | y = reorder(variable, -percentage), 19 | x = percentage 20 | )) + 21 | ggplot2::ylab(yaxis) + 22 | ggplot2::xlab(xaxis) + 23 | theme_plot 24 | 25 | return(plot) 26 | } 27 | -------------------------------------------------------------------------------- /R/overview_tab.R: -------------------------------------------------------------------------------- 1 | #' @title overview_tab 2 | #' 3 | #' @description Provides an overview table for the time and scope conditions of 4 | #' a data set. If a data.table object is provided, the function uses 5 | #' data.table's syntax to perform the evaluation 6 | #' 7 | #' @param dat A data frame or data table object 8 | #' @param id Scope (e.g., country codes or individual IDs) 9 | #' @param time Time (e.g., time periods given by years, months, ...). There are three options to add a date variable: 1) Time can be a character vector containing **one** time variable, 2) a time variable following the YYYY-MM-DD format, or 3) or a list containing multiple time variables (`time = list(year = NULL, month = NULL, day = NULL)`). 10 | #' @param complex_date Boolean argument identifying if there is a more complex (list-wise) date_time parameter (FALSE is the default) 11 | #' @return A data frame object that contains a summary of a sample that 12 | #' can later be converted to a 'LaTeX' output using \code{overview_latex} 13 | #' @examples 14 | #' # With version 1 (and also 2): 15 | #' 16 | #' data(toydata) 17 | #' output_table <- overview_tab(dat = toydata, id = ccode, time = year) 18 | #' 19 | #' # With version 3: 20 | #' overview_tab(dat = toydata, id = ccode, time = list( 21 | #' year = toydata$year, 22 | #' month = toydata$month, day = toydata$day 23 | #' ), complex_date = TRUE) 24 | #' 25 | #' @export 26 | #' @importFrom dplyr "%>%" 27 | #' @importFrom rlang := 28 | 29 | 30 | overview_tab <- function(dat, 31 | id, 32 | time = list(year = NULL, month = NULL, day = NULL), 33 | complex_date = FALSE) { 34 | 35 | 36 | # Check whether time contains multiple objects 37 | if (complex_date) { 38 | # Identify non-empty objects 39 | time <- time[lapply(time, length) > 0] 40 | 41 | if (is.null(time$day)) { 42 | stop( 43 | "The current version requires a day if you are providing multiple time arguments. Please also add a `day` in `time = list(year = ..., month = ..., day = ...)`." 44 | ) 45 | } 46 | # If month object is a character, convert it into numbers 47 | if (!is.null(time$month) & !is.numeric(time$month)) { 48 | date <- paste(time$year, time$month, time$day, sep = "-") 49 | 50 | # if (any(grepl("-$", date))) { 51 | # date <- gsub("-$", replacement = "", date) 52 | # } else if (any(grepl("--$", date))) { 53 | # date <- gsub("--$", replacement = "", date) 54 | # } 55 | 56 | # Convert a possible non-numeric month to a numeric month 57 | if (!is.null(time$year) & 58 | !is.null(time$month) & !is.null(time$day)) { 59 | dat$date_time <- 60 | as.Date(strftime(as.POSIXlt(date, format = "%Y-%b-%d"))) 61 | } 62 | } 63 | } 64 | 65 | if (any(class(dat) == "data.table")) { 66 | # Start with the data 67 | if (!complex_date) { 68 | time <- deparse(substitute(time)) 69 | } else { 70 | time <- deparse(substitute(date_time)) 71 | } 72 | id <- deparse(substitute(id)) 73 | col_names <- c(id, time) 74 | 75 | # Check if there are NAs in the time or id variable 76 | # (and drop them but warn the user about it) 77 | if (sum(is.na(dat[[id]])) > 0) { 78 | warning( 79 | "There is a missing value in your id variable. The missing value is automatically deleted." 80 | ) 81 | dat <- dat[!is.na(get(id)), col_names, with = FALSE] 82 | } 83 | 84 | output <- overview_tab_dt( 85 | dat = dat, 86 | id = id, 87 | time = time, 88 | col_names = col_names 89 | ) 90 | } else { 91 | # Start with the data 92 | if (!complex_date) { 93 | time <- rlang::ensym(time) 94 | } else { 95 | time <- "date_time" 96 | time <- rlang::ensym(time) 97 | } 98 | id <- rlang::ensym(id) 99 | 100 | 101 | # Check if there are NAs in the time or id variable 102 | # (and drop them but warn the user about it) 103 | dat2 <- dat %>% 104 | dplyr::filter(!is.na(!!id)) 105 | 106 | if (nrow(dat2) != nrow(dat)) { 107 | warning( 108 | "There is a missing value in your id variable. The missing value is automatically deleted." 109 | ) 110 | } 111 | 112 | output <- overview_tab_df( 113 | dat2 = dat2, 114 | dat = dat, 115 | id = id, 116 | time = time 117 | ) 118 | } 119 | return(output) 120 | } 121 | -------------------------------------------------------------------------------- /R/overview_tab_df.R: -------------------------------------------------------------------------------- 1 | #' @title overview_tab_df 2 | #' 3 | #' @description Internal function that calculates the `overview_tab` for data.frame objects 4 | #' 5 | #' @param dat2 Your data set 6 | #' @param dat Your data set 7 | #' @param id Scope (e.g., country codes or individual IDs) 8 | #' @param time Time (e.g., time periods given by years, months, ...). There are three options to add a date variable: 1) Time can be a character vector containing **one** time variable, 2) a time variable following the YYYY-MM-DD format, or 3) or a list containing multiple time variables (`time = list(year = NULL, month = NULL, day = NULL)`). 9 | #' @return A data.frame 10 | 11 | overview_tab_df <- function(dat2 = NULL, 12 | dat = NULL, 13 | id = NULL, 14 | time = NULL) { 15 | if (nrow(dat2) == nrow(dat)) { 16 | # Check the length of unique observations (based on time and id) in the 17 | # data set 18 | # We need this for the next check 19 | length_nodup <- dat %>% 20 | dplyr::distinct(!!id, !!time, .keep_all = TRUE) 21 | 22 | # Check if data set only has unique observations 23 | if (nrow(length_nodup) == nrow(dat)) { 24 | # Apply it to the data 25 | tab <- dat %>% 26 | # Select important variables 27 | dplyr::select(!!id, !!time) %>% 28 | # Group data 29 | dplyr::group_by(!!id, !!time) %>% 30 | # Arrange the data 31 | dplyr::arrange(!!id, !!time) %>% 32 | # Only get distinct IDs 33 | dplyr::distinct(!!id) %>% 34 | # Group by ID 35 | dplyr::group_by(!!id) %>% 36 | # Apply function generated above 37 | dplyr::mutate(time_frame = paste(find_int_runs(!!time), 38 | collapse = ", " 39 | )) %>% 40 | # Subset it to only one distinct country 41 | dplyr::distinct(!!id, time_frame) 42 | 43 | # Return object 44 | return(tab) 45 | } 46 | # If this is not the case, we need to aggregate the data 47 | else { 48 | dat2 <- dat %>% 49 | dplyr::select(!!id, !!time) %>% 50 | dplyr::group_by(!!id, !!time) %>% 51 | dplyr::distinct(!!id, !!time) 52 | 53 | # Apply code from above to the new data 54 | # Apply it to the data 55 | tab2 <- dat2 %>% 56 | # Select important variables 57 | dplyr::select(!!id, !!time) %>% 58 | # # Group data 59 | dplyr::group_by(!!id, !!time) %>% 60 | # Arrange the data 61 | dplyr::arrange(!!id, !!time) %>% 62 | # Only get distinct IDs 63 | dplyr::distinct(!!id) %>% 64 | # Group by ID 65 | dplyr::group_by(!!id) %>% 66 | # Apply function generated above 67 | dplyr::mutate(time_frame = paste(find_int_runs(!!time), 68 | collapse = ", " 69 | )) %>% 70 | # Subset it to only one distinct country 71 | dplyr::distinct(!!id, time_frame) 72 | 73 | return(tab2) 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /R/overview_tab_dt.R: -------------------------------------------------------------------------------- 1 | #' @title overview_tab_dt 2 | #' 3 | #' @description Internal function that calculates the `overview_tab` for data.table objects 4 | #' 5 | #' @param dat Your data set 6 | #' @param id Scope (e.g., country codes or individual IDs) 7 | #' @param time Time (e.g., time periods given by years, months, ...). There are three options to add a date variable: 1) Time can be a character vector containing **one** time variable, 2) a time variable following the YYYY-MM-DD format, or 3) or a list containing multiple time variables (`time = list(year = NULL, month = NULL, day = NULL)`). 8 | #' @param col_names The column names (containing id and time) 9 | #' @return A data.table 10 | 11 | overview_tab_dt <- function(dat = NULL, 12 | id = NULL, 13 | time = NULL, 14 | col_names = NULL) { 15 | 16 | # Check if data set only has unique observations 17 | if (nrow(unique(dat, by = c(id, time))) == nrow(dat)) { 18 | tab <- .overview_tab( 19 | dat = dat, 20 | id = id, 21 | time = time, 22 | col_names = col_names 23 | ) 24 | 25 | # Return object 26 | return(tab) 27 | } 28 | # If this is not the case, we need to aggregate the data 29 | else { 30 | dat <- unique(dat[, ..col_names]) 31 | 32 | # Apply code from above to the new data 33 | # Apply it to the data 34 | tab <- .overview_tab( 35 | dat = dat, 36 | id = id, 37 | time = time, 38 | col_names = col_names 39 | ) 40 | 41 | return(tab) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /R/private_overview_heat.R: -------------------------------------------------------------------------------- 1 | #' @title .overview_tab 2 | #' 3 | #' @description Internal function that calculates the `overview_tab` for data.table objects 4 | #' 5 | #' @param dat The data set 6 | #' @param id The scope (e.g., country codes or individual IDs). The axis is 7 | #' ordered in ascending order by default. 8 | #' @param time The time (e.g., time periods given by years, months, ...) 9 | #' @param perc If FALSE (default) plot returns the total number of observations 10 | #' per time-scope-unit. If TRUE, it returns the number of observations per 11 | #' time-scope-unit in percentage 12 | #' @param exp_total Expected total number of observations (i.e. maximum) 13 | #' for time unit. 14 | #' @param xaxis Label of your x axis ("Time frame" is default) 15 | #' @param yaxis Label of your y axis ("Sample" is default) 16 | #' @param col_low Hex color code for the lowest value (default is "#dceaf2") 17 | #' @param col_high Hex color code for the lowest value (default is "#2A5773") 18 | #' @param label If TRUE (default), the total number of observations/percentages 19 | #' of observations are displayed. If FALSE, it returns no labels. 20 | #' @param theme_plot Previously generated theme 21 | #' @param col_names The column names (containing id and time) 22 | #' @return A ggplot 23 | 24 | .overview_heat <- 25 | function(dat = NULL, 26 | id = NULL, 27 | time = NULL, 28 | label = FALSE, 29 | perc = FALSE, 30 | col_low = NULL, 31 | col_high = NULL, 32 | xaxis = NULL, 33 | yaxis = NULL, 34 | theme_plot = NULL, 35 | exp_total = NULL, 36 | col_names = NULL) { 37 | if (perc) { 38 | dat_agg <- dat %>% 39 | dplyr::group_by(!!id, !!time) %>% 40 | dplyr::mutate( 41 | count = dplyr::n(), 42 | total = count / exp_total 43 | ) 44 | } else { 45 | dat_agg <- dat %>% 46 | dplyr::group_by(!!id, !!time) %>% 47 | dplyr::mutate(count = dplyr::n()) 48 | } 49 | # Plot the result 50 | plot <- dat_agg %>% 51 | dplyr::ungroup() %>% 52 | dplyr::group_by(!!id) %>% 53 | ggplot2::ggplot(ggplot2::aes(factor(!!time), !!id)) + 54 | ggplot2::geom_tile(ggplot2::aes(fill = count), colour = "white") + 55 | ggplot2::scale_fill_gradient(low = col_low, high = col_high) + 56 | ggplot2::ylab(yaxis) + 57 | ggplot2::xlab(xaxis) + 58 | ggplot2::scale_y_discrete(limits = rev) + 59 | theme_plot 60 | 61 | # If there is a label, add it 62 | if (label & !perc) { 63 | plot <- plot + 64 | ggplot2::geom_text(ggplot2::aes(label = round(count, 1)), size = 3.3) 65 | } 66 | if (perc) { 67 | plot <- plot + 68 | ggplot2::geom_text(ggplot2::aes(label = paste(round(100 * total, 2), 69 | "%", 70 | sep = "" 71 | )), 72 | size = 3.3 73 | ) 74 | } 75 | return(plot) 76 | } 77 | -------------------------------------------------------------------------------- /R/private_overview_tab.R: -------------------------------------------------------------------------------- 1 | #' @title .overview_tab 2 | #' 3 | #' @description Internal function that calculates the `overview_tab` for data.table objects 4 | #' 5 | #' @param dat Your data set 6 | #' @param id Scope (e.g., country codes or individual IDs) 7 | #' @param time Time (e.g., time periods given by years, months, ...). There are three options to add a date variable: 1) Time can be a character vector containing **one** time variable, 2) a time variable following the YYYY-MM-DD format, or 3) or a list containing multiple time variables (`time = list(year = NULL, month = NULL, day = NULL)`). 8 | #' @param col_names The column names (containing id and time) 9 | #' @return A data.table 10 | 11 | .overview_tab <- function(dat = NULL, 12 | id = NULL, 13 | time = NULL, 14 | col_names = NULL) { 15 | return_cols <- c(id, "time_frame") 16 | dat <- 17 | unique(unique(dat[, ..col_names])[, list(time_frame = paste(find_int_runs(get(time)), collapse = ", ")), by = get(id)]) 18 | data.table::setnames(x = dat, old = "get", new = id) 19 | 20 | return(dat) 21 | } 22 | -------------------------------------------------------------------------------- /R/theme_heat_plot.R: -------------------------------------------------------------------------------- 1 | #' @title theme_heat_plot 2 | #' 3 | #' @description Defines the theme for the `overview_heat` plot function 4 | #' 5 | #' @return A theme for the `overview_heat` plot 6 | #' 7 | 8 | theme_heat_plot <- function() { 9 | theme_plot <- ggplot2::theme( 10 | # get rid of panel grids 11 | axis.line = ggplot2::element_blank(), 12 | axis.ticks = ggplot2::element_blank(), 13 | panel.border = ggplot2::element_blank(), 14 | panel.grid.major = ggplot2::element_blank(), 15 | panel.grid.minor = ggplot2::element_blank(), 16 | # Change plot and panel background 17 | plot.background = ggplot2::element_rect(fill = "white"), 18 | panel.background = ggplot2::element_rect(fill = "white"), 19 | # Change legend 20 | legend.direction = "horizontal", 21 | legend.position = "none", 22 | legend.background = ggplot2::element_rect(fill = "black", color = NA), 23 | legend.key = ggplot2::element_rect(color = "black", fill = "black"), 24 | legend.title = ggplot2::element_blank(), 25 | # Change text 26 | plot.caption = ggplot2::element_text(size = 5), 27 | axis.text = ggplot2::element_text( 28 | face = "plain", 29 | color = "black", 30 | size = 8 31 | ), 32 | text = ggplot2::element_text( 33 | size = 8, 34 | face = "plain" 35 | ) 36 | ) 37 | 38 | return(theme_plot) 39 | } 40 | -------------------------------------------------------------------------------- /R/theme_na_plot.R: -------------------------------------------------------------------------------- 1 | #' @title theme_na_plot 2 | #' 3 | #' @description Defines the theme for the `overview_na` plot function 4 | #' 5 | #' @return A theme for the `overview_na` plot 6 | #' 7 | theme_na_plot <- function() { 8 | plot_theme <- ggplot2::theme( 9 | # get rid of panel grids 10 | axis.line = ggplot2::element_blank(), 11 | axis.ticks.y = ggplot2::element_blank(), 12 | axis.ticks.x = ggplot2::element_blank(), 13 | panel.border = ggplot2::element_blank(), 14 | panel.grid.major = ggplot2::element_blank(), 15 | panel.grid.minor = ggplot2::element_blank(), 16 | # Change plot and panel background 17 | plot.background = ggplot2::element_rect(fill = "white"), 18 | panel.background = ggplot2::element_rect(fill = "white"), 19 | # Change legend 20 | legend.direction = "horizontal", 21 | legend.background = ggplot2::element_rect(fill = "black", color = NA), 22 | legend.key = ggplot2::element_rect(color = "black", fill = "black"), 23 | legend.title = ggplot2::element_blank(), 24 | # Change text 25 | plot.caption = ggplot2::element_text(size = 5), 26 | axis.text = ggplot2::element_text( 27 | face = "plain", 28 | color = "black", 29 | size = 8 30 | ), 31 | text = ggplot2::element_text( 32 | size = 10, 33 | face = "plain" 34 | ) 35 | ) 36 | 37 | return(plot_theme) 38 | } 39 | -------------------------------------------------------------------------------- /R/toydata.R: -------------------------------------------------------------------------------- 1 | #' Cross-sectional data for countries 2 | #' 3 | #' Small, artificially generated toy data set that comes in a cross-sectional 4 | #' format where the unit of analysis is either country-year or 5 | #' country-year-month. It provides artificial information for five countries 6 | #' (Angola, Benin, France, Rwanda, and the UK) for a time span from 1990 to 7 | #' 1999 to illustrate the use of the package. 8 | #' 9 | #' @docType data 10 | #' 11 | #' @usage data(toydata) 12 | #' 13 | #' @format An object of class \code{"data.frame"} 14 | #' \describe{ 15 | #' \item{ccode}{ISO3 country code (as character) for the countries in the 16 | #' sample (Angola, Benin, France, Rwanda, and UK)} 17 | #' \item{year}{A value between 1990 and 1999} 18 | #' \item{month}{An abbreviation (MMM) for month (character)} 19 | #' \item{gpd}{A fake value for GDP (randomly generated)} 20 | #' \item{population}{A fake value for population (randomly generated)} 21 | #' } 22 | #' @references This data set was artificially created for the overviewR package. 23 | #' @keywords datasets 24 | #' @examples 25 | #' 26 | #' data(toydata) 27 | #' head(toydata) 28 | "toydata" 29 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | template: 2 | package: preferably 3 | bootstrap: 5 4 | 5 | development: 6 | mode: auto 7 | 8 | home: 9 | strip_header: false 10 | 11 | 12 | navbar: 13 | title: "overviewR" 14 | type: inverse 15 | structure: 16 | left: 17 | - tabular 18 | - plot 19 | - workflow 20 | - cheatsheet 21 | - articles 22 | right: 23 | - reference 24 | - news 25 | - github 26 | - home 27 | components: 28 | articles: 29 | text: Articles 30 | menu: 31 | - text: Getting started 32 | href: articles/getting-started.html 33 | - text: overviewR 34 | href: articles/overviewR_vignette.html 35 | reference: 36 | text: Reference 37 | href: reference/index.html 38 | news: 39 | icon: fa-lightbulb 40 | text: News 41 | href: news/index.html 42 | cheatsheet: 43 | icon: fa-sticky-note 44 | text: CheatSheet 45 | href: https://github.com/rstudio/cheatsheets/blob/main/overviewR.pdf 46 | github: 47 | icon: fab fa-github fa-lg 48 | href: https://github.com/cosimameyer/overviewR/ 49 | tabular: 50 | icon: fa-table 51 | text: Tabular overview 52 | menu: 53 | - text: overview_tab 54 | href: articles/overviewR_vignette.html#overview_tab 55 | - text: overview_crosstab 56 | href: articles/overviewR_vignette.html#overview_crosstab 57 | - text: Export results 58 | href: articles/overviewR_vignette.html#overview_latex 59 | plot: 60 | icon: fa-chart-bar 61 | text: Visual overview 62 | menu: 63 | - text: overview_plot 64 | href: articles/overviewR_vignette.html#overview_plot 65 | - text: overview_crossplot 66 | href: articles/overviewR_vignette.html#overview_crossplot 67 | - text: overview_heat 68 | href: articles/overviewR_vignette.html#overview_heat 69 | - text: overview_na 70 | href: articles/overviewR_vignette.html#overview_na 71 | - text: overview_overlap 72 | href: articles/overviewR_vignette.html#overview_overlap 73 | - text: Customize plots 74 | href: articles/overviewR_vignette.html#customizing-plots-ggplot2 75 | workflow: 76 | icon: fa-project-diagram 77 | text: Workflow 78 | menu: 79 | - text: Using the tidyverse 80 | href: articles/overviewR_vignette.html#workflow-tidyverse 81 | - text: Presenting tables 82 | href: articles/overviewR_vignette.html#presenting-tables-flextable-xtable-and-kable 83 | - text: Extension 84 | href: articles/overviewR_vignette.html#extension 85 | 86 | 87 | authors: 88 | "Cosima Meyer": 89 | href: http://cosimameyer.rbind.io 90 | "Dennis Hammerschmidt": 91 | href: http://dennis-hammerschmidt.rbind.io 92 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Submission 2 | 3 | This is a submission for an updated version of this package. It includes a fix for `overview_overlap` that caused testing failures. 4 | 5 | ## Test environments 6 | 7 | * Windows Server 2022, R-devel, 64 bit (on win-devel) 8 | * macOS Ventura 13.1, R 4.1.3 (local machine) 9 | * Ubuntu Linux 20.04.1 LTS, R-release, GCC 10 | * Fedora Linux, R-devel, clang, gfortran 11 | 12 | ## R CMD check results 13 | There were no ERRORs or WARNINGs. 14 | 15 | There is one NOTE that is only found on Windows (Server 2022, R-devel 64-bit): 16 | 17 | ``` 18 | * checking for detritus in the temp directory ... NOTE 19 | Found the following files/directories: 20 | 'lastMiKTeXException' 21 | ``` 22 | 23 | As mentioned in the [R-hub issue #503](https://github.com/r-hub/rhub/issues/503), this warning could occur due to a bug in MiKTeX and can likely be ignored. 24 | 25 | There is one NOTE that is only found on (Fedora Linux, R-devel, clang, gfortran) 26 | 27 | ``` 28 | * checking HTML version of manual ... NOTE 29 | Skipping checking HTML validation: no command 'tidy' found 30 | ``` 31 | 32 | As described [here](https://groups.google.com/g/r-sig-mac/c/7u_ivEj4zhM), our understanding is that this is an old bug/issue which is located at the testing environment. 33 | 34 | ## Downstream dependencies 35 | There are currently no downstream dependencies for this package. 36 | -------------------------------------------------------------------------------- /data/toydata.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/data/toydata.RData -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Page not found (404) • overviewR 10 | 11 | 12 | 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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | 162 | 163 | 164 | 165 |
166 | 167 |
168 |
169 | 172 | 173 | Content not found. Please use links in the navbar. 174 | 175 |
176 | 177 | 182 | 183 |
184 | 185 | 186 | 187 | 197 |
198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /docs/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/articles/ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/ex1.png -------------------------------------------------------------------------------- /docs/articles/ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/ex2.png -------------------------------------------------------------------------------- /docs/articles/ex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/ex3.png -------------------------------------------------------------------------------- /docs/articles/extension1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/extension1.png -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Articles • overviewR 10 | 11 | 12 | 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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | 162 | 163 | 164 | 165 |
166 | 167 |
168 |
169 | 172 | 173 |
174 |

All vignettes

175 |

176 | 177 |
178 |
overviewR: Easily Extracting Information About Your Data
179 |
180 |
181 |
182 |
183 |
184 | 185 | 186 | 196 |
197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-26-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-26-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-31-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-31-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-32-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-32-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-33-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/articles/overviewR_vignette_files/figure-html/unnamed-chunk-33-1.png -------------------------------------------------------------------------------- /docs/articles/overviewR_vignette_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Authors • overviewR 10 | 11 | 12 | 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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | 162 | 163 | 164 | 165 |
166 | 167 |
168 |
169 | 172 | 173 | 183 | 184 |
185 | 186 |
187 | 188 | 189 | 190 | 200 |
201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /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/bootstrap-toc.js: -------------------------------------------------------------------------------- 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 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /docs/dev/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/dev/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/dev/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /docs/dev/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/dev/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/dev/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/dev/articles/ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/ex1.png -------------------------------------------------------------------------------- /docs/dev/articles/ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/ex2.png -------------------------------------------------------------------------------- /docs/dev/articles/ex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/ex3.png -------------------------------------------------------------------------------- /docs/dev/articles/extension1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/extension1.png -------------------------------------------------------------------------------- /docs/dev/articles/getting-started_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-28-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-28-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-29-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-29-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-30-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-30-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-31-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-31-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-32-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-32-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-33-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-33-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-38-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/articles/overviewR_vignette_files/figure-html/unnamed-chunk-38-1.png -------------------------------------------------------------------------------- /docs/dev/articles/overviewR_vignette_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/dev/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/dev/bootstrap-toc.js: -------------------------------------------------------------------------------- 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 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /docs/dev/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/dev/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/favicon-16x16.png -------------------------------------------------------------------------------- /docs/dev/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/favicon-32x32.png -------------------------------------------------------------------------------- /docs/dev/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/favicon.ico -------------------------------------------------------------------------------- /docs/dev/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/dev/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/logo.png -------------------------------------------------------------------------------- /docs/dev/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent; 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /docs/dev/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.11.4 2 | pkgdown: 1.6.1 3 | pkgdown_sha: ~ 4 | articles: 5 | getting-started: getting-started.html 6 | overviewR_vignette: overviewR_vignette.html 7 | last_built: 2021-06-10T05:13Z 8 | 9 | -------------------------------------------------------------------------------- /docs/dev/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/CheatSheet_overviewR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/CheatSheet_overviewR.pdf -------------------------------------------------------------------------------- /docs/dev/reference/figures/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/bar.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/dot.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/ex1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/ex2.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/ex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/ex3.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/extension1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/extension1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/logo.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-26-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-26-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-28-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-28-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-29-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-29-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-30-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-30-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-31-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-31-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-32-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-32-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-33-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-33-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-34-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-34-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-35-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-35-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-36-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-36-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/unnamed-chunk-37-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/unnamed-chunk-37-1.png -------------------------------------------------------------------------------- /docs/dev/reference/figures/venn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/figures/venn.png -------------------------------------------------------------------------------- /docs/dev/reference/overview_crossplot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/overview_crossplot-1.png -------------------------------------------------------------------------------- /docs/dev/reference/overview_heat-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/overview_heat-1.png -------------------------------------------------------------------------------- /docs/dev/reference/overview_na-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/overview_na-1.png -------------------------------------------------------------------------------- /docs/dev/reference/overview_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/dev/reference/overview_plot-1.png -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/favicon.ico -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/logo.png -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent; 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.11.0.4 2 | pkgdown: 1.6.1 3 | pkgdown_sha: ~ 4 | last_built: 2021-06-08T09:05Z 5 | 6 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/figures/CheatSheet_overviewR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/CheatSheet_overviewR.pdf -------------------------------------------------------------------------------- /docs/reference/figures/ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/ex1.png -------------------------------------------------------------------------------- /docs/reference/figures/ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/ex2.png -------------------------------------------------------------------------------- /docs/reference/figures/ex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/ex3.png -------------------------------------------------------------------------------- /docs/reference/figures/extension1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/extension1.png -------------------------------------------------------------------------------- /docs/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/logo.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-26-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-26-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-28-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-28-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-30-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-30-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-31-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-31-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-32-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-32-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-33-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-33-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-34-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/figures/unnamed-chunk-34-1.png -------------------------------------------------------------------------------- /docs/reference/overview_crossplot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/overview_crossplot-1.png -------------------------------------------------------------------------------- /docs/reference/overview_heat-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/overview_heat-1.png -------------------------------------------------------------------------------- /docs/reference/overview_na-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/overview_na-1.png -------------------------------------------------------------------------------- /docs/reference/overview_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/docs/reference/overview_plot-1.png -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | # Getting started 2 | 3 | 4 | 5 | [![R-CMD-check](https://github.com/cosimameyer/overviewR/workflows/R-CMD-check/badge.svg)](https://github.com/cosimameyer/overviewR/actions) 6 | [![Codecov test 7 | coverage](https://codecov.io/gh/cosimameyer/overviewR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/cosimameyer/overviewR?branch=master) 8 | [![Project Status: Active – The project has reached a stable, usable 9 | state and is being actively 10 | developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) 11 | [![overviewR 12 | badge](https://img.shields.io/badge/overviewR-ready%20to%20use-brightgreen)](https://github.com/cosimameyer/overviewR) 13 | [![R 14 | badge](https://img.shields.io/badge/Build%20with-♥%20and%20R-blue)](https://github.com/cosimameyer/overviewR) 15 | [![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/overviewR)](https://cran.r-project.org/package=overviewR) 16 | [![license](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ## What is `overviewR`? 27 | 28 | overviewR is a small yet powerful package that helps you to **get an overview** – hence, the name – **of your data** with particular emphasis on the **extent that your distinct units of observation are covered for the entire time frame** of your data set. 29 | 30 | 31 | ## How can you install it? 32 | 33 | 34 | A stable version of `overviewR` can be directly accessed on CRAN: 35 | 36 | ``` r 37 | install.packages("overviewR", force = TRUE) 38 | ``` 39 | 40 | To install the latest development version of `overviewR` directly from 41 | [GitHub](https://github.com/cosimameyer/overviewR) use: 42 | 43 | ``` r 44 | library(devtools) # Tools to Make Developing R Packages Easier # Tools to Make Developing R Packages Easier 45 | devtools::install_github("cosimameyer/overviewR") 46 | ``` 47 | 48 | 49 | ## Why did we build it? 50 | 51 | If you have a (large) data set that has many different observations over a long period, it becomes increasingly **difficult to identify for each unique observation its exact coverage in the data**. In particular, if some observations are not included for the entire time span of the data – either because they entered later, dropped out earlier or have gaps in between – it can become difficult to spot potential problems in your data’s time and scope. 52 | 53 | overviewR allows you to **quickly get a glimpse of your data and the distribution of your observations over time**. With its ability to **produce both data.frame objects and LaTeX/.tex outputs**, it can be used by **practitioners and academics alike**. 54 | 55 | ## How can it be used? 56 | 57 | overviewR can be used by everyone who works with data that have **time-and-scope characteristics**. That is, all data that contains different units of observation over a specific period will benefit from overviewR. To get a quick overview of **which units** – think of countries, companies, test persons, etc. – **are present or missing during a given time span** – think of years, months, days, minutes, etc. – overviewR provides an **easy and intuitive insight** into the set-up of your data. 58 | 59 | Consider a data set that covers countries over the past 50 years. **Not all countries existed throughout the entire period** – some dissolved, others were newly founded and yet for others, data might not be available for the entire period. Before starting any analysis, it is helpful to get an overview not only of which countries are included and what the entire time span is but also to **see which countries are present at which points in time**. In other words, are there missing data for certain countries at different points in time? 60 | 61 | To get a quick and intuitive overview of your data, overviewR provides currently the following basic functions: 62 | 63 | - **overview_tab** generates a basic table that lists all unique units of observation (e.g., countries) and aggregates the time frame at which each unit is present in the data set. This means it also takes into account gaps in the data set, e.g., when there is – for whatever reason – no data available for a country for a few years within the time frame 64 | - **overview_crosstab** generates a similar table but allows you to separate the overview table using two conditions. For instance, you want to know not only at what time points countries are present in your data but also when these countries can be considered to have high or low GDP and can be categorized as having a small or large population size. For this, overview_crosstab is used. 65 | overview_print takes a table – either generated by overview_tab or overview_crosstab and turns it into a LaTeX output. It even allows you to save the LaTeX output in a ready-to-use .tex file. 66 | - **overview_plot** visualizes the time and scope conditions of your data in a ggplot plot. For each scope object in your data (e.g., countries) on the y-axis, it plots the time coverage (x-axis) as a horizontal line for all time points in your data. This helps to spot gaps in your data for specific scope objects or simply creates a graphical display of your time and scope conditions and can be a good companion for presentation slides or appendices. 67 | overview_crossplot is an alternative to visualize a cross table (a way to present results from overview_crosstab) 68 | - **overview_heat** visualizes the coverage of each time and scope combination of your dataset in a heat map style ggplot. Each cell in the heat map is colored based on the coverage of a scope object at a given time point. Additionally, it displays either the total number of cases covered or a relative percentage as plain text. This helps to spot missing information even more nuanced. For instance, in a monthly data set with countries as the scope object, it illustrates the percentage of covered months in the data for each country-year combination. 69 | - **overview_na** graphically illustrates the total number of NAs across all variables in your data set as a horizontal bar plot. Similar to the other plot objects, overview_na returns a ggplot object and can be modified and adjusted accordingly. 70 | - **overview_overlap** plots the overlap between two data sets. 71 | 72 | There is also a [CheatSheet](https://github.com/rstudio/cheatsheets/blob/main/overviewR.pdf) available here that showcases the functions of overviewR. 73 | 74 | 75 | ## Get involved! 76 | 77 | Have you used overviewR in your project? **Let us know!** You can either e-mail us or use our pull-request template and populate/fill the following with your information: 78 | 79 | ``` 80 | **PROJECT TITLE**: 81 | --SHORT DESCRIPTION HOW YOU USED OVERVIEWR-- 82 | [*LINK TO YOUR WEBSITE*](https://LINK-TO-YOUR-WEBSITE) 83 | ``` 84 | 85 | We will feature your project below! 86 | 87 | ## Projects using overviewR 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /man/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/.DS_Store -------------------------------------------------------------------------------- /man/calculate_share_non_row_wise.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/calculate_share_non_row_wise.R 3 | \name{calculate_share_non_row_wise} 4 | \alias{calculate_share_non_row_wise} 5 | \title{calculate_share_non_row_wise} 6 | \usage{ 7 | calculate_share_non_row_wise(dat = NULL) 8 | } 9 | \arguments{ 10 | \item{dat}{Data frame} 11 | } 12 | \value{ 13 | The function returns a data set that has the information 14 | on the column-wise NA share 15 | } 16 | \description{ 17 | Function used in `overview_na` to calculate the column-wise share of NA 18 | } 19 | -------------------------------------------------------------------------------- /man/calculate_share_row_wise.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/calculate_share_row_wise.R 3 | \name{calculate_share_row_wise} 4 | \alias{calculate_share_row_wise} 5 | \title{calculate_share_row_wise} 6 | \usage{ 7 | calculate_share_row_wise(dat = NULL) 8 | } 9 | \arguments{ 10 | \item{dat}{Data frame} 11 | } 12 | \value{ 13 | The function returns a data set that has the information 14 | on the row-wise NA share 15 | } 16 | \description{ 17 | Function used in `overview_na` to calculate the share of NA row-wise 18 | } 19 | -------------------------------------------------------------------------------- /man/dot-overview_heat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/private_overview_heat.R 3 | \name{.overview_heat} 4 | \alias{.overview_heat} 5 | \title{.overview_tab} 6 | \usage{ 7 | .overview_heat( 8 | dat = NULL, 9 | id = NULL, 10 | time = NULL, 11 | label = FALSE, 12 | perc = FALSE, 13 | col_low = NULL, 14 | col_high = NULL, 15 | xaxis = NULL, 16 | yaxis = NULL, 17 | theme_plot = NULL, 18 | exp_total = NULL, 19 | col_names = NULL 20 | ) 21 | } 22 | \arguments{ 23 | \item{dat}{The data set} 24 | 25 | \item{id}{The scope (e.g., country codes or individual IDs). The axis is 26 | ordered in ascending order by default.} 27 | 28 | \item{time}{The time (e.g., time periods given by years, months, ...)} 29 | 30 | \item{label}{If TRUE (default), the total number of observations/percentages 31 | of observations are displayed. If FALSE, it returns no labels.} 32 | 33 | \item{perc}{If FALSE (default) plot returns the total number of observations 34 | per time-scope-unit. If TRUE, it returns the number of observations per 35 | time-scope-unit in percentage} 36 | 37 | \item{col_low}{Hex color code for the lowest value (default is "#dceaf2")} 38 | 39 | \item{col_high}{Hex color code for the lowest value (default is "#2A5773")} 40 | 41 | \item{xaxis}{Label of your x axis ("Time frame" is default)} 42 | 43 | \item{yaxis}{Label of your y axis ("Sample" is default)} 44 | 45 | \item{theme_plot}{Previously generated theme} 46 | 47 | \item{exp_total}{Expected total number of observations (i.e. maximum) 48 | for time unit.} 49 | 50 | \item{col_names}{The column names (containing id and time)} 51 | } 52 | \value{ 53 | A ggplot 54 | } 55 | \description{ 56 | Internal function that calculates the `overview_tab` for data.table objects 57 | } 58 | -------------------------------------------------------------------------------- /man/dot-overview_tab.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/private_overview_tab.R 3 | \name{.overview_tab} 4 | \alias{.overview_tab} 5 | \title{.overview_tab} 6 | \usage{ 7 | .overview_tab(dat = NULL, id = NULL, time = NULL, col_names = NULL) 8 | } 9 | \arguments{ 10 | \item{dat}{Your data set} 11 | 12 | \item{id}{Scope (e.g., country codes or individual IDs)} 13 | 14 | \item{time}{Time (e.g., time periods given by years, months, ...). There are three options to add a date variable: 1) Time can be a character vector containing **one** time variable, 2) a time variable following the YYYY-MM-DD format, or 3) or a list containing multiple time variables (`time = list(year = NULL, month = NULL, day = NULL)`).} 15 | 16 | \item{col_names}{The column names (containing id and time)} 17 | } 18 | \value{ 19 | A data.table 20 | } 21 | \description{ 22 | Internal function that calculates the `overview_tab` for data.table objects 23 | } 24 | -------------------------------------------------------------------------------- /man/figures/CheatSheet_overviewR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/CheatSheet_overviewR.pdf -------------------------------------------------------------------------------- /man/figures/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/bar.png -------------------------------------------------------------------------------- /man/figures/dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/dot.png -------------------------------------------------------------------------------- /man/figures/ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/ex1.png -------------------------------------------------------------------------------- /man/figures/ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/ex2.png -------------------------------------------------------------------------------- /man/figures/ex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/ex3.png -------------------------------------------------------------------------------- /man/figures/extension1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/extension1.png -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/logo.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-26-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-26-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-28-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-28-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-29-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-29-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-30-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-30-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-31-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-31-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-32-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-32-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-33-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-33-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-34-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-34-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-35-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-35-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-36-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-36-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-37-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-37-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-38-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-38-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-39-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/unnamed-chunk-39-1.png -------------------------------------------------------------------------------- /man/figures/venn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/man/figures/venn.png -------------------------------------------------------------------------------- /man/find_int_runs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/helper.R 3 | \name{find_int_runs} 4 | \alias{find_int_runs} 5 | \title{find_int_runs} 6 | \usage{ 7 | find_int_runs(run = NULL) 8 | } 9 | \arguments{ 10 | \item{run}{Variable (integer) that should be checked for consecutive values} 11 | } 12 | \value{ 13 | The function returns a data set 14 | } 15 | \description{ 16 | Function used in `overview_tab` to find running integers 17 | } 18 | -------------------------------------------------------------------------------- /man/overview_add_na_output.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_add_na_output.R 3 | \name{overview_add_na_output} 4 | \alias{overview_add_na_output} 5 | \title{overview_add_na_output} 6 | \usage{ 7 | overview_add_na_output(dat_result = NULL, dat = NULL) 8 | } 9 | \arguments{ 10 | \item{dat_result}{Data.frame from `overview_na`} 11 | 12 | \item{dat}{Data frame} 13 | } 14 | \value{ 15 | The function returns a data set that has the information 16 | on the row-wise NA share 17 | } 18 | \description{ 19 | Function used in `overview_na` to generate a new data frame with 20 | na_count and percentage share of NAs for each row 21 | } 22 | -------------------------------------------------------------------------------- /man/overview_crossplot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_crossplot.R 3 | \name{overview_crossplot} 4 | \alias{overview_crossplot} 5 | \title{overview_crossplot} 6 | \usage{ 7 | overview_crossplot( 8 | dat, 9 | id, 10 | time, 11 | cond1, 12 | cond2, 13 | threshold1, 14 | threshold2, 15 | xaxis = "Condition 1", 16 | yaxis = "Condition 2", 17 | label = FALSE, 18 | color = FALSE, 19 | dot_size = 2, 20 | fontsize = 2.5 21 | ) 22 | } 23 | \arguments{ 24 | \item{dat}{Your data set} 25 | 26 | \item{id}{Your scope (e.g., country codes or individual IDs). If the id 27 | variable contains NAs, they will not be included in the plot.} 28 | 29 | \item{time}{Your time (e.g., time periods given by years, months, ...)} 30 | 31 | \item{cond1}{Variable that describes the first condition} 32 | 33 | \item{cond2}{Variable that describes the second condition} 34 | 35 | \item{threshold1}{A threshold for \code{cond1}} 36 | 37 | \item{threshold2}{A threshold for \code{cond2}} 38 | 39 | \item{xaxis}{Label of the x axis ("Condition 1" is default)} 40 | 41 | \item{yaxis}{Label of the y axis ("Condition 2" is default)} 42 | 43 | \item{label}{Label of the observations. Overlapping labels are 44 | avoided by using 'ggrepel'} 45 | 46 | \item{color}{Color of the different observation groups} 47 | 48 | \item{dot_size}{Option argument that defines the dot size (default is 2)} 49 | 50 | \item{fontsize}{If label is TRUE, the fontsize arguments allows to define the text of the labels (the default is 2.5)} 51 | } 52 | \value{ 53 | A ggplot figure that presents the sample information visually 54 | in a cross table 55 | } 56 | \description{ 57 | This function plots a ggplot to visualize a cross table plot. 58 | } 59 | \examples{ 60 | data(toydata) 61 | overview_crossplot( 62 | dat = toydata, 63 | cond1 = gdp, 64 | cond2 = population, 65 | threshold1 = 25000, 66 | threshold2 = 27000, 67 | id = ccode, 68 | time = year 69 | ) 70 | } 71 | -------------------------------------------------------------------------------- /man/overview_crosstab.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_crosstab.R 3 | \name{overview_crosstab} 4 | \alias{overview_crosstab} 5 | \title{overview_crosstab} 6 | \usage{ 7 | overview_crosstab(dat, cond1, cond2, threshold1, threshold2, id, time) 8 | } 9 | \arguments{ 10 | \item{dat}{A data set object} 11 | 12 | \item{cond1}{Variable that describes the first condition} 13 | 14 | \item{cond2}{Variable that describes the second condition} 15 | 16 | \item{threshold1}{A threshold for \code{cond1}} 17 | 18 | \item{threshold2}{A threshold for \code{cond2}} 19 | 20 | \item{id}{Scope (e.g., country codes or individual IDs)} 21 | 22 | \item{time}{Time (e.g., time periods given by years, months, ...)} 23 | } 24 | \value{ 25 | A data frame object that contains a summary of the data set that can 26 | later be converted to a 'LaTeX' output using \code{overview_latex} 27 | } 28 | \description{ 29 | Sorts a data set conditionally in a cross table. 30 | This can be helpful to get a sense of the time and scope 31 | conditions of a data set. Note, if used with a data set that has multiple 32 | observations on the id-time unit, the function automatically aggregates 33 | this information using the mean. 34 | } 35 | \examples{ 36 | data(toydata) 37 | overview_crosstab( 38 | dat = toydata, 39 | cond1 = gdp, 40 | cond2 = population, 41 | threshold1 = 25000, 42 | threshold2 = 27000, 43 | id = ccode, 44 | time = year 45 | ) 46 | } 47 | -------------------------------------------------------------------------------- /man/overview_heat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_heat.R 3 | \name{overview_heat} 4 | \alias{overview_heat} 5 | \title{overview_heat} 6 | \usage{ 7 | overview_heat( 8 | dat, 9 | id, 10 | time, 11 | perc = FALSE, 12 | exp_total = NULL, 13 | xaxis = "Time frame", 14 | yaxis = "Sample", 15 | col_low = "#dceaf2", 16 | col_high = "#2A5773", 17 | label = TRUE 18 | ) 19 | } 20 | \arguments{ 21 | \item{dat}{The data set} 22 | 23 | \item{id}{The scope (e.g., country codes or individual IDs). The axis is 24 | ordered in ascending order by default.} 25 | 26 | \item{time}{The time (e.g., time periods given by years, months, ...)} 27 | 28 | \item{perc}{If FALSE (default) plot returns the total number of observations 29 | per time-scope-unit. If TRUE, it returns the number of observations per 30 | time-scope-unit in percentage} 31 | 32 | \item{exp_total}{Expected total number of observations (i.e. maximum) 33 | for time unit.} 34 | 35 | \item{xaxis}{Label of your x axis ("Time frame" is default)} 36 | 37 | \item{yaxis}{Label of your y axis ("Sample" is default)} 38 | 39 | \item{col_low}{Hex color code for the lowest value (default is "#dceaf2")} 40 | 41 | \item{col_high}{Hex color code for the lowest value (default is "#2A5773")} 42 | 43 | \item{label}{If TRUE (default), the total number of observations/percentages 44 | of observations are displayed. If FALSE, it returns no labels.} 45 | } 46 | \value{ 47 | A ggplot figure that presents sample coverage visually 48 | } 49 | \description{ 50 | This function plots a heat map to visualize the 51 | coverage of the time-scope-units of the data. Options include total 52 | number of cases per time-scope-unit or relative number in percentage. 53 | } 54 | \examples{ 55 | data(toydata) 56 | overview_heat(toydata, ccode, year, perc = TRUE, exp_total = 12) 57 | } 58 | -------------------------------------------------------------------------------- /man/overview_latex.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_latex.R 3 | \name{overview_latex} 4 | \alias{overview_latex} 5 | \title{overview_latex} 6 | \usage{ 7 | overview_latex( 8 | obj, 9 | title = "Time and scope of the sample", 10 | id = "Sample", 11 | time = "Time frame", 12 | crosstab = FALSE, 13 | cond1 = "Condition 1", 14 | cond2 = "Condition 2", 15 | save_out = FALSE, 16 | file_path, 17 | label = "tab:tab1", 18 | fontsize, 19 | file, 20 | path 21 | ) 22 | } 23 | \arguments{ 24 | \item{obj}{Overview object produced by overview_tab or overview_crosstab} 25 | 26 | \item{title}{Caption of the table (default is "Time and scope of the sample")} 27 | 28 | \item{id}{The name of the left column (default is "Sample"), will be ignored 29 | if crosstab is TRUE} 30 | 31 | \item{time}{The name of the right column (default is ("Time frame")), will 32 | be ignored if \code{crosstab} is TRUE} 33 | 34 | \item{crosstab}{Logical argument, if TRUE produces a \code{crosstab} output, 35 | default is FALSE} 36 | 37 | \item{cond1}{Description for the first condition (character), will be 38 | ignored if \code{crosstab} is FALSE. This should correspond to the input 39 | for \code{cond1} in \code{overview_crosstab}} 40 | 41 | \item{cond2}{Description for the second condition (character), will be 42 | ignored if \code{crosstab} is FALSE. This should correspond to the input 43 | for \code{cond2} in \code{overview_crosstab}} 44 | 45 | \item{save_out}{Optional argument, exports the output table as a .tex 46 | file, default is FALSE} 47 | 48 | \item{file_path}{Specifies the path and file name (.tex) where you store your output} 49 | 50 | \item{label}{Specifies the label (default is "tab:tab1")} 51 | 52 | \item{fontsize}{Specifies the font size (all 'LaTeX' font sizes such as 53 | "scriptsize" or "small" work)} 54 | 55 | \item{file}{This argument is deprecated. Please use "file_path" instead and add the full path.} 56 | 57 | \item{path}{This argument is deprecated. Please use "file_path" instead and add the full path.} 58 | } 59 | \value{ 60 | A 'LaTeX' output that can either be copy-pasted in a text document or 61 | exported directed as a .tex file 62 | } 63 | \description{ 64 | Produces a 'LaTeX' output for output obtained via 65 | \code{overview_tab} and \code{overview_crosstab} 66 | } 67 | \examples{ 68 | data(toydata) 69 | 70 | overview_object <- overview_tab(dat = toydata, id = ccode, time = year) 71 | overview_latex( 72 | obj = overview_object, 73 | title = "Some nice title", 74 | crosstab = FALSE 75 | ) 76 | 77 | #' overview_object <- overview_tab(dat = toydata, id = ccode, time = year) 78 | overview_latex( 79 | obj = overview_object, 80 | title = "Some nice title", 81 | file_path = "some/path_to/your_output_file.tex" 82 | ) 83 | 84 | overview_ct_object <- overview_crosstab( 85 | dat = toydata, 86 | cond1 = gdp, 87 | cond2 = population, 88 | threshold1 = 25000, 89 | threshold2 = 27000, 90 | id = ccode, 91 | time = year 92 | ) 93 | overview_latex( 94 | obj = overview_ct_object, 95 | title = "Some nice title for a cross tab", 96 | crosstab = TRUE, 97 | cond1 = "Name of first condition", 98 | cond2 = "Name of second condition" 99 | ) 100 | } 101 | -------------------------------------------------------------------------------- /man/overview_na.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_na.R 3 | \name{overview_na} 4 | \alias{overview_na} 5 | \title{overview_na} 6 | \usage{ 7 | overview_na( 8 | dat, 9 | yaxis = "Variables", 10 | perc = TRUE, 11 | row_wise = FALSE, 12 | add = FALSE 13 | ) 14 | } 15 | \arguments{ 16 | \item{dat}{Your data set} 17 | 18 | \item{yaxis}{Label of your y axis ("Variables" is default)} 19 | 20 | \item{perc}{If TRUE (default) plot returns the number of NAs in percentage} 21 | 22 | \item{row_wise}{If TRUE (FALSE is default) plot return the number of NAs 23 | per row} 24 | 25 | \item{add}{If TRUE (FALSE is default) it generates a new data frame with 26 | na_count and percentage share of NAs for each row} 27 | } 28 | \value{ 29 | Depending on the selection, the function returns a ggplot figure that 30 | presents the distribution of NAs in the data set or adds the information 31 | on the row-wise NA share 32 | } 33 | \description{ 34 | This function plots a ggplot to visualize the distribution of 35 | NAs across all variables in the data set. 36 | } 37 | \examples{ 38 | data(toydata) 39 | overview_na(toydata, perc = FALSE) 40 | } 41 | -------------------------------------------------------------------------------- /man/overview_overlap.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_overlap.R 3 | \name{overview_overlap} 4 | \alias{overview_overlap} 5 | \title{overview_overlap} 6 | \usage{ 7 | overview_overlap( 8 | dat1, 9 | dat2, 10 | dat1_id, 11 | dat2_id, 12 | dat1_name = "Data set 1", 13 | dat2_name = "Data set 2", 14 | plot_type = "bar" 15 | ) 16 | } 17 | \arguments{ 18 | \item{dat1}{A first data set object} 19 | 20 | \item{dat2}{A second data set object} 21 | 22 | \item{dat1_id}{Scope (e.g., country codes or individual IDs) of dat1. 23 | It is important that both ID variables are exactly the same to generate 24 | the perfect match.} 25 | 26 | \item{dat2_id}{Scope (e.g., country codes or individual IDs) of dat2. 27 | It is important that both ID variables are exactly the same to generate 28 | the perfect match.} 29 | 30 | \item{dat1_name}{Name of dat1 ("Data set 1" is the default)} 31 | 32 | \item{dat2_name}{Name of dat2 ("Data set 2" is the default)} 33 | 34 | \item{plot_type}{Type of plot ("bar" and "venn" are the two options) "venn" 35 | relies on the ggvenn function} 36 | } 37 | \value{ 38 | A ggplot2 object (bar chart) that shows the overlap of two data sets. 39 | } 40 | \description{ 41 | Provides an overview of the overlap of two data sets. 42 | Cautionary note: This function is currently only preliminary workable 43 | and can only capture 2 data sets. We are working on an extension that 44 | allows to compare multiple data sets. 45 | } 46 | \examples{ 47 | \dontrun{ 48 | data(toydata) 49 | toydata2 <- toydata[which(toydata$year > 1992), ] 50 | overview_overlap( 51 | dat1 = toydata, dat2 = toydata2, dat1_id = ccode, 52 | dat2_id = ccode 53 | ) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /man/overview_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_plot.R 3 | \name{overview_plot} 4 | \alias{overview_plot} 5 | \title{overview_plot} 6 | \usage{ 7 | overview_plot( 8 | dat, 9 | id, 10 | time, 11 | xaxis = "Time frame", 12 | yaxis = "Sample", 13 | asc = TRUE, 14 | color, 15 | dot_size = 2 16 | ) 17 | } 18 | \arguments{ 19 | \item{dat}{Your data set} 20 | 21 | \item{id}{Your scope (e.g., country codes or individual IDs). If the id 22 | variable contains NAs, they will not be included in the plot.} 23 | 24 | \item{time}{Your time (e.g., time periods given by years, months, ...)} 25 | 26 | \item{xaxis}{Label of the x axis ("Time frame" is default)} 27 | 28 | \item{yaxis}{Label of the y axis ("Sample" is default)} 29 | 30 | \item{asc}{Sorting the y axis in ascending order ("TRUE" is default)} 31 | 32 | \item{color}{Optional argument that defines the color} 33 | 34 | \item{dot_size}{Option argument that defines the dot size (default is 2)} 35 | } 36 | \value{ 37 | A ggplot figure that presents the sample information visually 38 | } 39 | \description{ 40 | This function plots a ggplot to visualize the distribution of 41 | scope objects across the time frame. 42 | } 43 | \examples{ 44 | data(toydata) 45 | overview_plot(dat = toydata, id = ccode, time = year) 46 | } 47 | -------------------------------------------------------------------------------- /man/overview_plot_absolute.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_plot_absolute.R 3 | \name{overview_plot_absolute} 4 | \alias{overview_plot_absolute} 5 | \title{overview_plot_absolute} 6 | \usage{ 7 | overview_plot_absolute( 8 | dat_result = NULL, 9 | theme_plot = NULL, 10 | yaxis = NULL, 11 | xaxis = NULL 12 | ) 13 | } 14 | \arguments{ 15 | \item{dat_result}{Data frame} 16 | 17 | \item{theme_plot}{Theme for the plot (pre-defined)} 18 | 19 | \item{yaxis}{Name for yaxis} 20 | 21 | \item{xaxis}{Name for xaxix} 22 | } 23 | \value{ 24 | The function returns a ggplot 25 | } 26 | \description{ 27 | Function used in `overview_na` to plot the absolute share of NA values 28 | } 29 | -------------------------------------------------------------------------------- /man/overview_plot_percentage.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_plot_percentage.R 3 | \name{overview_plot_percentage} 4 | \alias{overview_plot_percentage} 5 | \title{overview_plot_percentage} 6 | \usage{ 7 | overview_plot_percentage( 8 | dat_result = NULL, 9 | theme_plot = NULL, 10 | yaxis = NULL, 11 | xaxis = NULL 12 | ) 13 | } 14 | \arguments{ 15 | \item{dat_result}{Data frame} 16 | 17 | \item{theme_plot}{Theme for the plot (pre-defined)} 18 | 19 | \item{yaxis}{Name for yaxis} 20 | 21 | \item{xaxis}{Name for xaxix} 22 | } 23 | \value{ 24 | The function returns a ggplot 25 | } 26 | \description{ 27 | Function used in `overview_na` to plot the percentage share of NA values 28 | } 29 | -------------------------------------------------------------------------------- /man/overview_tab.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_tab.R 3 | \name{overview_tab} 4 | \alias{overview_tab} 5 | \title{overview_tab} 6 | \usage{ 7 | overview_tab( 8 | dat, 9 | id, 10 | time = list(year = NULL, month = NULL, day = NULL), 11 | complex_date = FALSE 12 | ) 13 | } 14 | \arguments{ 15 | \item{dat}{A data frame or data table object} 16 | 17 | \item{id}{Scope (e.g., country codes or individual IDs)} 18 | 19 | \item{time}{Time (e.g., time periods given by years, months, ...). There are three options to add a date variable: 1) Time can be a character vector containing **one** time variable, 2) a time variable following the YYYY-MM-DD format, or 3) or a list containing multiple time variables (`time = list(year = NULL, month = NULL, day = NULL)`).} 20 | 21 | \item{complex_date}{Boolean argument identifying if there is a more complex (list-wise) date_time parameter (FALSE is the default)} 22 | } 23 | \value{ 24 | A data frame object that contains a summary of a sample that 25 | can later be converted to a 'LaTeX' output using \code{overview_latex} 26 | } 27 | \description{ 28 | Provides an overview table for the time and scope conditions of 29 | a data set. If a data.table object is provided, the function uses 30 | data.table's syntax to perform the evaluation 31 | } 32 | \examples{ 33 | # With version 1 (and also 2): 34 | 35 | data(toydata) 36 | output_table <- overview_tab(dat = toydata, id = ccode, time = year) 37 | 38 | # With version 3: 39 | overview_tab(dat = toydata, id = ccode, time = list( 40 | year = toydata$year, 41 | month = toydata$month, day = toydata$day 42 | ), complex_date = TRUE) 43 | 44 | } 45 | -------------------------------------------------------------------------------- /man/overview_tab_df.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_tab_df.R 3 | \name{overview_tab_df} 4 | \alias{overview_tab_df} 5 | \title{overview_tab_df} 6 | \usage{ 7 | overview_tab_df(dat2 = NULL, dat = NULL, id = NULL, time = NULL) 8 | } 9 | \arguments{ 10 | \item{dat2}{Your data set} 11 | 12 | \item{dat}{Your data set} 13 | 14 | \item{id}{Scope (e.g., country codes or individual IDs)} 15 | 16 | \item{time}{Time (e.g., time periods given by years, months, ...). There are three options to add a date variable: 1) Time can be a character vector containing **one** time variable, 2) a time variable following the YYYY-MM-DD format, or 3) or a list containing multiple time variables (`time = list(year = NULL, month = NULL, day = NULL)`).} 17 | } 18 | \value{ 19 | A data.frame 20 | } 21 | \description{ 22 | Internal function that calculates the `overview_tab` for data.frame objects 23 | } 24 | -------------------------------------------------------------------------------- /man/overview_tab_dt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/overview_tab_dt.R 3 | \name{overview_tab_dt} 4 | \alias{overview_tab_dt} 5 | \title{overview_tab_dt} 6 | \usage{ 7 | overview_tab_dt(dat = NULL, id = NULL, time = NULL, col_names = NULL) 8 | } 9 | \arguments{ 10 | \item{dat}{Your data set} 11 | 12 | \item{id}{Scope (e.g., country codes or individual IDs)} 13 | 14 | \item{time}{Time (e.g., time periods given by years, months, ...). There are three options to add a date variable: 1) Time can be a character vector containing **one** time variable, 2) a time variable following the YYYY-MM-DD format, or 3) or a list containing multiple time variables (`time = list(year = NULL, month = NULL, day = NULL)`).} 15 | 16 | \item{col_names}{The column names (containing id and time)} 17 | } 18 | \value{ 19 | A data.table 20 | } 21 | \description{ 22 | Internal function that calculates the `overview_tab` for data.table objects 23 | } 24 | -------------------------------------------------------------------------------- /man/theme_heat_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/theme_heat_plot.R 3 | \name{theme_heat_plot} 4 | \alias{theme_heat_plot} 5 | \title{theme_heat_plot} 6 | \usage{ 7 | theme_heat_plot() 8 | } 9 | \value{ 10 | A theme for the `overview_heat` plot 11 | } 12 | \description{ 13 | Defines the theme for the `overview_heat` plot function 14 | } 15 | -------------------------------------------------------------------------------- /man/theme_na_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/theme_na_plot.R 3 | \name{theme_na_plot} 4 | \alias{theme_na_plot} 5 | \title{theme_na_plot} 6 | \usage{ 7 | theme_na_plot() 8 | } 9 | \value{ 10 | A theme for the `overview_na` plot 11 | } 12 | \description{ 13 | Defines the theme for the `overview_na` plot function 14 | } 15 | -------------------------------------------------------------------------------- /man/toydata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/toydata.R 3 | \docType{data} 4 | \name{toydata} 5 | \alias{toydata} 6 | \title{Cross-sectional data for countries} 7 | \format{ 8 | An object of class \code{"data.frame"} 9 | \describe{ 10 | \item{ccode}{ISO3 country code (as character) for the countries in the 11 | sample (Angola, Benin, France, Rwanda, and UK)} 12 | \item{year}{A value between 1990 and 1999} 13 | \item{month}{An abbreviation (MMM) for month (character)} 14 | \item{gpd}{A fake value for GDP (randomly generated)} 15 | \item{population}{A fake value for population (randomly generated)} 16 | } 17 | } 18 | \usage{ 19 | data(toydata) 20 | } 21 | \description{ 22 | Small, artificially generated toy data set that comes in a cross-sectional 23 | format where the unit of analysis is either country-year or 24 | country-year-month. It provides artificial information for five countries 25 | (Angola, Benin, France, Rwanda, and the UK) for a time span from 1990 to 26 | 1999 to illustrate the use of the package. 27 | } 28 | \examples{ 29 | 30 | data(toydata) 31 | head(toydata) 32 | } 33 | \references{ 34 | This data set was artificially created for the overviewR package. 35 | } 36 | \keyword{datasets} 37 | -------------------------------------------------------------------------------- /overviewR.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 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(overviewR) 3 | 4 | test_check("overviewR") 5 | -------------------------------------------------------------------------------- /tests/testthat/test-dt_output.R: -------------------------------------------------------------------------------- 1 | test_that("overview_tab() returns same results regardless of using 2 | data.table or data.frame", { 3 | output_table <- overview_tab(dat = toydata, id = ccode, time = year) 4 | toydata_copy <- data.table::copy(toydata) 5 | toydata_dt <- data.table::setDT(toydata_copy) 6 | output_table2 <- 7 | overview_tab(dat = toydata_dt, id = ccode, time = year) 8 | expect_equal(nrow(output_table2), nrow(output_table)) 9 | }) 10 | 11 | test_that("overview_tab() returns same results regardless of using 12 | data.table or data.frame", { 13 | toydata_no_dup <- 14 | toydata %>% 15 | dplyr::select(ccode, year) %>% 16 | dplyr::group_by(ccode, year) %>% 17 | dplyr::distinct() 18 | output_table <- 19 | overview_tab(dat = toydata_no_dup, id = ccode, time = year) 20 | toydata_no_dup_copy <- data.table::copy(toydata_no_dup) 21 | toydata_dt <- data.table::setDT(toydata_no_dup_copy) 22 | output_table2 <- 23 | overview_tab(dat = toydata_dt, id = ccode, time = year) 24 | expect_equal(nrow(output_table2), nrow(output_table)) 25 | }) 26 | 27 | test_that("overview_na() returns same results regardless of using data.table 28 | or data.frame", { 29 | output <- overview_na(dat = toydata) 30 | toydata_copy <- data.table::copy(toydata) 31 | toydata_dt <- data.table::setDT(toydata_copy) 32 | output2 <- overview_na(dat = toydata_dt) 33 | testthat::expect_is(output2, "ggplot") 34 | testthat::expect_is(output, "ggplot") 35 | }) 36 | 37 | test_that( 38 | "overview_na() returns same results regardless of using data.table 39 | or data.frame (row_wise=TRUE)", 40 | { 41 | output <- overview_na(dat = toydata, row_wise = TRUE) 42 | toydata_copy <- data.table::copy(toydata) 43 | toydata_dt <- data.table::setDT(toydata_copy) 44 | output2 <- 45 | overview_na(dat = toydata_dt, row_wise = TRUE) 46 | testthat::expect_is(output2, "ggplot") 47 | testthat::expect_is(output, "ggplot") 48 | } 49 | ) 50 | 51 | test_that( 52 | "overview_na() returns same results regardless of using data.table 53 | or data.frame (add=TRUE)", 54 | { 55 | output <- overview_na(dat = toydata, row_wise = TRUE, add = TRUE) 56 | toydata_copy <- data.table::copy(toydata) 57 | toydata_dt <- data.table::setDT(toydata_copy) 58 | output2 <- 59 | overview_na(dat = toydata_dt, row_wise = TRUE, add = TRUE) 60 | testthat::expect_is(output2, "data.frame") 61 | testthat::expect_is(output, "data.frame") 62 | } 63 | ) 64 | 65 | test_that("check output of overview_heat with dt", { 66 | toydata_copy <- data.table::copy(toydata) 67 | toydata_dt <- data.table::setDT(toydata_copy) 68 | 69 | plot_heat <- 70 | overview_heat(toydata_dt, 71 | ccode, 72 | year, 73 | perc = TRUE, 74 | exp_total = 12 75 | ) 76 | testthat::expect_is(plot_heat, "ggplot") 77 | plot_heat_abs <- 78 | overview_heat(toydata_dt, ccode, year, perc = FALSE) 79 | testthat::expect_is(plot_heat_abs, "ggplot") 80 | }) 81 | 82 | test_that("for complex_date in overview_tab", { 83 | toydata_copy <- data.table::copy(toydata) 84 | toydata_dt <- data.table::setDT(toydata_copy) 85 | 86 | output_table <- 87 | overview_tab( 88 | dat = toydata, 89 | id = ccode, 90 | time = list( 91 | year = toydata$year, 92 | month = toydata$month, 93 | day = toydata$day 94 | ), 95 | complex_date = TRUE 96 | ) 97 | output_table2 <- 98 | overview_tab( 99 | dat = toydata_dt, 100 | id = ccode, 101 | time = list( 102 | year = toydata_dt$year, 103 | month = toydata_dt$month, 104 | day = toydata_dt$day 105 | ), 106 | complex_date = TRUE 107 | ) 108 | expect_equal(nrow(output_table2), nrow(output_table)) 109 | }) 110 | 111 | 112 | test_that("Get a warning message from overview_tab", { 113 | data_test <- toydata %>% 114 | dplyr::mutate(ccode = ifelse(ccode == "RWA", NA, ccode)) 115 | 116 | toydata_copy <- data.table::copy(data_test) 117 | toydata_dt <- data.table::setDT(toydata_copy) 118 | 119 | expect_warning( 120 | overview_tab(dat = toydata_dt, id = ccode, time = year) 121 | ) 122 | }) 123 | -------------------------------------------------------------------------------- /vignettes/ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/ex1.png -------------------------------------------------------------------------------- /vignettes/ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/ex2.png -------------------------------------------------------------------------------- /vignettes/ex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/ex3.png -------------------------------------------------------------------------------- /vignettes/extension1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/extension1.png -------------------------------------------------------------------------------- /vignettes/getting-started.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Getting started" 3 | description: > 4 | Learn what overviewR is about 5 | output: rmarkdown::html_vignette 6 | vignette: > 7 | %\VignetteIndexEntry{Getting started} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | 13 | ## What is overviewR? 14 | 15 | overviewR is a small yet powerful package that helps you to **get an overview** – hence, the name – **of your data** with particular emphasis on the **extent that your distinct units of observation are covered for the entire time frame** of your data set. 16 | 17 | 18 | ## How can you install it? 19 | 20 | A stable version of `overviewR` can be directly accessed on CRAN: 21 | ```{r, eval=FALSE} 22 | install.packages("overviewR", force = TRUE) 23 | ``` 24 | 25 | To install the latest development version of `overviewR` directly from [GitHub](https://github.com/cosimameyer/overviewR) use: 26 | 27 | ```{r, message=FALSE, warning=FALSE, results = "hide", eval=FALSE} 28 | library(devtools) 29 | devtools::install_github("cosimameyer/overviewR") 30 | ``` 31 | 32 | 33 | ## Why did we build it? 34 | 35 | If you have a (large) data set that has many different observations over a long period, it becomes increasingly **difficult to identify for each unique observation its exact coverage in the data**. In particular, if some observations are not included for the entire time span of the data – either because they entered later, dropped out earlier or have gaps in between – it can become difficult to spot potential problems in your data’s time and scope. 36 | 37 | overviewR allows you to **quickly get a glimpse of your data and the distribution of your observations over time**. With its ability to **produce both data.frame objects and LaTeX/.tex outputs**, it can be used by **practitioners and academics alike**. 38 | 39 | ## How can it be used? 40 | 41 | overviewR can be used by everyone who works with data that have **time-and-scope characteristics**. That is, all data that contains different units of observation over a specific period will benefit from overviewR. To get a quick overview of **which units** – think of countries, companies, test persons, etc. – **are present or missing during a given time span** – think of years, months, days, minutes, etc. – overviewR provides an **easy and intuitive insight** into the set-up of your data. 42 | 43 | Consider a data set that covers countries over the past 50 years. **Not all countries existed throughout the entire period** – some dissolved, others were newly founded and yet for others, data might not be available for the entire period. Before starting any analysis, it is helpful to get an overview not only of which countries are included and what the entire time span is but also to **see which countries are present at which points in time**. In other words, are there missing data for certain countries at different points in time? 44 | 45 | To get a quick and intuitive overview of your data, overviewR provides currently the following basic functions: 46 | 47 | - **overview_tab** generates a basic table that lists all unique units of observation (e.g., countries) and aggregates the time frame at which each unit is present in the data set. This means it also takes into account gaps in the data set, e.g., when there is – for whatever reason – no data available for a country for a few years within the time frame 48 | - **overview_crosstab** generates a similar table but allows you to separate the overview table using two conditions. For instance, you want to know not only at what time points countries are present in your data but also when these countries can be considered to have high or low GDP and can be categorized as having a small or large population size. For this, overview_crosstab is used. 49 | - **overview_latex** takes a table – either generated by overview_tab or overview_crosstab and turns it into a LaTeX output. It even allows you to save the LaTeX output in a ready-to-use .tex file. 50 | - **overview_plot** visualizes the time and scope conditions of your data in a ggplot plot. For each scope object in your data (e.g., countries) on the y-axis, it plots the time coverage (x-axis) as a horizontal line for all time points in your data. This helps to spot gaps in your data for specific scope objects or simply creates a graphical display of your time and scope conditions and can be a good companion for presentation slides or appendices. 51 | overview_crossplot is an alternative to visualize a cross table (a way to present results from overview_crosstab) 52 | - **overview_heat** visualizes the coverage of each time and scope combination of your dataset in a heat map style ggplot. Each cell in the heat map is colored based on the coverage of a scope object at a given time point. Additionally, it displays either the total number of cases covered or a relative percentage as plain text. This helps to spot missing information even more nuanced. For instance, in a monthly data set with countries as the scope object, it illustrates the percentage of covered months in the data for each country-year combination. 53 | - **overview_na** graphically illustrates the total number of NAs across all variables in your data set as a horizontal bar plot. Similar to the other plot objects, overview_na returns a ggplot object and can be modified and adjusted accordingly. 54 | - **overview_overlap** provides an overview of the overlap of two data sets 55 | 56 | ## Overview of functional add-ons 57 | | | Works with `data.frame` objects | Works with `data.table` | Can take multiple time arguments (year, month, day) | 58 | |-----------------------|---------------------------------|-------------------------|-----------------------------------------------------| 59 | | `overview_tab` | yes | yes | yes | 60 | | `overview_na` | yes | yes | | 61 | | `overview_plot` | yes | | | 62 | | `overview_crossplot` | yes | | | 63 | | `overview_crosstab` | yes | | | 64 | | `overview_heat` | yes | | | 65 | | `overview_overlap` | yes | | | 66 | 67 | 68 | There is also a [CheatSheet](https://github.com/rstudio/cheatsheets/blob/main/overviewR.pdf) available here that showcases the functions of overviewR. 69 | 70 | 71 | ## Get involved! 72 | 73 | Have you used overviewR in your project? **Let us know!** You can either e-mail us or use our pull-request template and populate/fill the following with your information: 74 | 75 | ``` 76 | **PROJECT TITLE**: 77 | --SHORT DESCRIPTION HOW YOU USED OVERVIEWR-- 78 | [*LINK TO YOUR WEBSITE*](https://LINK-TO-YOUR-WEBSITE) 79 | ``` 80 | 81 | We will feature your project below! 82 | 83 | ## Projects using overviewR 84 | -------------------------------------------------------------------------------- /vignettes/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /vignettes/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /vignettes/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /vignettes/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /vignettes/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /vignettes/unnamed-chunk-28-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosimameyer/overviewR/7552d260a2b781de90b6c99ff9fdeab3a0b56658/vignettes/unnamed-chunk-28-1.png --------------------------------------------------------------------------------