diff --git a/.github/.gitignore b/.github/.gitignore index f920f889..2d19fc76 100644 --- a/.github/.gitignore +++ b/.github/.gitignore @@ -1,2 +1 @@ - *.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml deleted file mode 100644 index 38a50449..00000000 --- a/.github/workflows/R-CMD-check.yaml +++ /dev/null @@ -1,49 +0,0 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -on: - push: - branches: [main, DEV] - pull_request: - branches: [main, DEV] - -name: R-CMD-check - -jobs: - R-CMD-check: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - - {os: macos-latest, r: 'release'} - - {os: windows-latest, r: 'release'} - - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel-1'} - - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - R_KEEP_PKG_SOURCE: yes - - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - http-user-agent: ${{ matrix.config.http-user-agent }} - use-public-rspm: true - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::rcmdcheck - needs: check - - - uses: r-lib/actions/check-r-package@v2 - with: - upload-snapshots: true diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index e8b23619..fab5c5f7 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -2,14 +2,16 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [DEV, master] + branches: [wbpage-0.2.3] pull_request: - branches: [DEV, master] + branches: [wbpage-0.2.3] release: types: [published] workflow_dispatch: -name: pkgdown +name: pkgdown.yaml + +permissions: read-all jobs: pkgdown: diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml deleted file mode 100644 index ddf8b7bd..00000000 --- a/.github/workflows/test-coverage.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -on: - push: - branches: [main, DEV] - pull_request: - branches: [main, DEV] - -name: test-coverage - -jobs: - test-coverage: - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::covr - needs: coverage - - - name: Test coverage - run: | - covr::codecov( - quiet = FALSE, - clean = FALSE, - install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") - ) - shell: Rscript {0} - - - name: Show testthat output - if: always() - run: | - ## -------------------------------------------------------------------- - find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash - - - name: Upload test results - if: failure() - uses: actions/upload-artifact@v3 - with: - name: coverage-test-failures - path: ${{ runner.temp }}/package diff --git a/.gitignore b/.gitignore index 061b0855..6247c85b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,4 @@ .RData .Ruserdata -inst/doc -doc -Meta - docs -/doc/ -/Meta/ diff --git a/docs/404.html b/docs/404.html index 5b3191b7..4c817195 100644 --- a/docs/404.html +++ b/docs/404.html @@ -24,7 +24,7 @@ joyn - 0.2.0 + 0.2.3 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 0cb29cc4..21c01725 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -10,7 +10,7 @@ joyn - 0.2.0 + 0.2.3 diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 8c534f59..f9c90b4b 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -10,7 +10,7 @@ joyn - 0.2.0 + 0.2.3 diff --git a/docs/articles/adv-functionalities.html b/docs/articles/adv-functionalities.html index 5a89ac74..6e363b4d 100644 --- a/docs/articles/adv-functionalities.html +++ b/docs/articles/adv-functionalities.html @@ -26,7 +26,7 @@ joyn - 0.2.0 + 0.2.3 @@ -128,27 +128,25 @@ 1. Use variable co #> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 4 44.4% -#> 2: x & y 1 11.1% -#> 3: y 4 44.4% -#> 4: total 9 100% +#> .joyn n percent +#> 1 x 4 44.4% +#> 2 y 4 44.4% +#> 3 x & y 1 11.1% +#> 4 total 9 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id and country from id, gdp, and country -#> Key: <id, country> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id and country from id, gdp, and country #> id t country gdp .joyn -#> <num> <int> <num> <int> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 16 11 x & y +#> <num> <int> <num> <int> <fctr> +#> 1: 1 1 16 11 x & y +#> 2: 4 2 12 NA x #> 3: 2 1 3 NA x -#> 4: 2 NA 17 15 y -#> 5: 3 2 NA NA x -#> 6: 3 NA 20 10 y -#> 7: 4 2 12 NA x -#> 8: 5 NA 18 20 y -#> 9: 6 NA 19 13 y +#> 4: 3 2 NA NA x +#> 5: NA NA 15 NA x +#> 6: 2 NA 17 15 y +#> 7: 5 NA 18 20 y +#> 8: 6 NA 19 13 y +#> 9: 3 NA 20 10 y Alternatively, you can specify to join by country @@ -160,23 +158,21 @@ 1. Use variable co #> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 4 44.4% -#> 2: x & y 1 11.1% -#> 3: y 4 44.4% -#> 4: total 9 100% +#> .joyn n percent +#> 1 x 4 44.4% +#> 2 y 4 44.4% +#> 3 x & y 1 11.1% +#> 4 total 9 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables country from id, gdp, and country -#> Key: <country> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables country from id, gdp, and country #> id t country gdp .joyn -#> <num> <int> <num> <int> <char> -#> 1: 3 2 NA NA x -#> 2: 2 1 3 NA x -#> 3: 4 2 12 NA x -#> 4: NA NA 15 NA x -#> 5: 1 1 16 11 x & y +#> <num> <int> <num> <int> <fctr> +#> 1: 1 1 16 11 x & y +#> 2: 4 2 12 NA x +#> 3: 2 1 3 NA x +#> 4: 3 2 NA NA x +#> 5: NA NA 15 NA x #> 6: NA NA 17 15 y #> 7: NA NA 18 20 y #> 8: NA NA 19 13 y @@ -196,23 +192,21 @@ #> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 28.6% -#> 2: x & y 3 42.9% -#> 3: y 2 28.6% -#> 4: total 7 100% +#> .joyn n percent +#> 1 x 2 28.6% +#> 2 y 2 28.6% +#> 3 x & y 3 42.9% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, gdp, and country -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, gdp, and country #> id t country gdp .joyn -#> <num> <int> <num> <int> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 16 11 x & y +#> <num> <int> <num> <int> <fctr> +#> 1: 1 1 16 11 x & y +#> 2: 4 2 12 NA x #> 3: 2 1 3 15 x & y #> 4: 3 2 NA 10 x & y -#> 5: 4 2 12 NA x +#> 5: NA NA 15 NA x #> 6: 5 NA NA 20 y #> 7: 6 NA NA 13 y @@ -234,23 +228,21 @@ 3. Update only NAs in table x#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: NA updated 3 42.9% -#> 2: x 2 28.6% -#> 3: x & y 2 28.6% -#> 4: total 7 100% +#> .joyn n percent +#> 1 x 2 28.6% +#> 2 x & y 2 28.6% +#> 3 NA updated 3 42.9% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, gdp, and country -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, gdp, and country #> id t country gdp .joyn -#> <num> <int> <num> <int> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 16 11 x & y +#> <num> <int> <num> <int> <fctr> +#> 1: 1 1 16 11 x & y +#> 2: 4 2 12 NA x #> 3: 2 1 3 15 x & y #> 4: 3 2 20 10 NA updated -#> 5: 4 2 12 NA x +#> 5: NA NA 15 NA x #> 6: 5 NA 18 20 NA updated #> 7: 6 NA 19 13 NA updated @@ -289,23 +281,21 @@ 4. Update actual values in table x#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: NA updated 3 42.9% -#> 2: not updated 2 28.6% -#> 3: value updated 2 28.6% -#> 4: total 7 100% +#> .joyn n percent +#> 1 NA updated 3 42.9% +#> 2 value updated 2 28.6% +#> 3 not updated 2 28.6% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, gdp, and country -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, gdp, and country #> id t country gdp .joyn -#> <num> <int> <num> <int> <char> -#> 1: NA NA 15 NA not updated -#> 2: 1 1 16 11 value updated +#> <num> <int> <num> <int> <fctr> +#> 1: 1 1 16 11 value updated +#> 2: 4 2 12 NA not updated #> 3: 2 1 17 15 value updated #> 4: 3 2 20 10 NA updated -#> 5: 4 2 12 NA not updated +#> 5: NA NA 15 NA not updated #> 6: 5 NA 18 20 NA updated #> 7: 6 NA 19 13 NA updated @@ -334,23 +324,21 @@ (K #> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 28.6% -#> 2: x & y 3 42.9% -#> 3: y 2 28.6% -#> 4: total 7 100% +#> .joyn n percent +#> 1 x 2 28.6% +#> 2 y 2 28.6% +#> 3 x & y 3 42.9% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, gdp, and country -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, gdp, and country #> id t country.x gdp country.y .joyn -#> <num> <int> <num> <int> <int> <char> -#> 1: NA NA 15 NA NA x -#> 2: 1 1 16 11 16 x & y +#> <num> <int> <num> <int> <int> <fctr> +#> 1: 1 1 16 11 16 x & y +#> 2: 4 2 12 NA NA x #> 3: 2 1 3 15 17 x & y #> 4: 3 2 NA 10 20 x & y -#> 5: 4 2 12 NA NA x +#> 5: NA NA 15 NA NA x #> 6: 5 NA NA 20 18 y #> 7: 6 NA NA 13 19 y @@ -372,22 +360,20 @@ Bring other variables #> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 28.6% -#> 2: x & y 3 42.9% -#> 3: y 2 28.6% -#> 4: total 7 100% +#> .joyn n percent +#> 1 x 2 28.6% +#> 2 y 2 28.6% +#> 3 x & y 3 42.9% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn #> id t country gdp .joyn -#> <num> <int> <num> <int> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 16 11 x & y +#> <num> <int> <num> <int> <fctr> +#> 1: 1 1 16 11 x & y +#> 2: 4 2 12 NA x #> 3: 2 1 3 15 x & y #> 4: 3 2 NA 10 x & y -#> 5: 4 2 12 NA x +#> 5: NA NA 15 NA x #> 6: 5 NA NA 20 y #> 7: 6 NA NA 13 y Notice that if you set y_vars_to_keep = FALSE or diff --git a/docs/articles/aux-functions.html b/docs/articles/aux-functions.html index ba229364..3bfac999 100644 --- a/docs/articles/aux-functions.html +++ b/docs/articles/aux-functions.html @@ -26,7 +26,7 @@ joyn - 0.2.0 + 0.2.3 @@ -127,11 +127,10 @@ Verifying if dt is uniquely iden by = "id") #> #> ── Duplicates in terms of `id` -#> copies n percent -#> <char> <int> <char> -#> 1: 1 3 75% -#> 2: 2 1 25% -#> 3: total 4 100% +#> copies n percent +#> 1 1 3 75% +#> 2 2 1 25% +#> 3 total 4 100% #> ─────────────────────────────────────────────────────── End of is_id() report ── #> [1] FALSE @@ -142,11 +141,10 @@ Verifying if dt is uniquely iden return_report = FALSE) #> #> ── Duplicates in terms of `id` -#> copies n percent -#> <char> <int> <char> -#> 1: 1 3 75% -#> 2: 2 1 25% -#> 3: total 4 100% +#> copies n percent +#> 1 1 3 75% +#> 2 2 1 25% +#> 3 total 4 100% #> ─────────────────────────────────────────────────────── End of is_id() report ── #> [1] FALSE @@ -225,27 +223,24 @@ Tabulating simple frequencies# Tabulating frequencies of var `id` freq_table(x = x1, - byvar = "id") -#> id n percent -#> <char> <int> <char> -#> 1: <NA> 1 20% -#> 2: 1 2 40% -#> 3: 2 1 20% -#> 4: 3 1 20% -#> 5: total 5 100% + byvar = "id")[] +#> id n percent +#> 1 1 2 40% +#> 2 2 1 20% +#> 3 3 1 20% +#> 4 <NA> 1 20% +#> 5 total 5 100% # Removing NAs from the calculation freq_table(x = x1, byvar = "id", - na.rm = TRUE) -#> id n percent -#> <char> <int> <char> -#> 1: <NA> 1 20% -#> 2: 1 2 40% -#> 3: 2 1 20% -#> 4: 3 1 20% -#> 5: total 5 100% + na.rm = TRUE)[] +#> id n percent +#> 1 1 2 50% +#> 2 2 1 25% +#> 3 3 1 25% +#> 4 total 4 100% diff --git a/docs/articles/dplyr-joins.html b/docs/articles/dplyr-joins.html index 466facc7..94b24148 100644 --- a/docs/articles/dplyr-joins.html +++ b/docs/articles/dplyr-joins.html @@ -26,7 +26,7 @@ joyn - 0.2.0 + 0.2.3 @@ -151,22 +151,21 @@ Rationale#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 40% -#> 2: x & y 3 60% -#> 3: total 5 100% +#> .joyn n percent +#> 1 x 2 40% +#> 2 y 1 20% +#> 3 x & y 2 40% +#> 4 total 5 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id and y -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id and y #> id t x y .joyn -#> <num> <int> <int> <num> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 11 11 x & y -#> 3: 1 2 12 11 x & y -#> 4: 2 1 13 15 x & y -#> 5: 3 2 14 NA x +#> <num> <int> <int> <num> <fctr> +#> 1: 1 1 11 11 x & y +#> 2: 1 2 12 11 x & y +#> 3: 2 1 13 15 x & y +#> 4: 3 2 14 NA x +#> 5: NA NA 15 NA x # Option 2 @@ -176,24 +175,23 @@ Rationale#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 40% -#> 2: x & y 3 60% -#> 3: total 5 100% +#> .joyn n percent +#> 1 x 2 40% +#> 2 y 1 20% +#> 3 x & y 2 40% +#> 4 total 5 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id and y -#> ⚠ Warning: joyn does not currently allow inequality joins, so keep = NULL will +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id and y +#> ⚠ Warning: joyn does not currently allow inequality joins, so keep = NULL will #> retain only keys in x -#> Key: <id> #> id t x y .joyn -#> <num> <int> <int> <num> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 11 11 x & y -#> 3: 1 2 12 11 x & y -#> 4: 2 1 13 15 x & y -#> 5: 3 2 14 NA x +#> <num> <int> <int> <num> <fctr> +#> 1: 1 1 11 11 x & y +#> 2: 1 2 12 11 x & y +#> 3: 2 1 13 15 x & y +#> 4: 3 2 14 NA x +#> 5: NA NA 15 NA x # Option 3 @@ -255,22 +253,21 @@ 1. Left join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: NA updated 1 16.7% -#> 2: x 1 16.7% -#> 3: x & y 4 66.7% -#> 4: total 6 100% +#> .joyn n percent +#> 1 x 1 16.7% +#> 2 x & y 4 66.7% +#> 3 NA updated 1 16.7% +#> 4 total 6 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, y, and t +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, y, and t #> id t.x x y t.y .joyn -#> 5 NA 16 15 17 16 NA updated -#> 6 NA 4 16 17 16 x & y #> 1 1 1 11 11 13 x & y #> 2 1 2 12 11 13 x & y #> 3 2 1 13 15 14 x & y -#> 4 3 2 14 NA NA x +#> 4 3 2 14 NA NA x +#> 5 NA 16 15 17 16 NA updated +#> 6 NA 4 16 17 16 x & y Specifying which variables to keep from the right table after the join @@ -283,20 +280,20 @@ 1. Left join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 1 16.7% -#> 2: x & y 5 83.3% -#> 3: total 6 100% +#> .joyn n percent +#> 1 x 1 16.7% +#> 2 y 2 33.3% +#> 3 x & y 3 50% +#> 4 total 6 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn +#> ℹ Note: Joyn's report available in variable .joyn #> id t x y .joyn -#> 5 NA NA 15 17 x & y -#> 6 NA 4 16 17 x & y #> 1 1 1 11 11 x & y #> 2 1 2 12 11 x & y #> 3 2 1 13 15 x & y -#> 4 3 2 14 NA x +#> 4 3 2 14 NA x +#> 5 NA NA 15 17 x & y +#> 6 NA 4 16 17 x & y 2. Right join @@ -318,22 +315,22 @@ 2. Right join#> #> ── JOYn Report ── #> -#> right.joyn n percent -#> <char> <int> <char> -#> 1: x & y 5 71.4% -#> 2: y 2 28.6% -#> 3: total 7 100% +#> right.joyn n percent +#> 1 x 1 14.3% +#> 2 y 2 28.6% +#> 3 x & y 4 57.1% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable right.joyn -#> ℹ ❯ Removing key variables id from id, y, and t +#> ℹ Note: Joyn's report available in variable right.joyn +#> ℹ Note: Removing key variables id from id, y, and t #> id t.x x y t.y right.joyn -#> 4 NA NA 15 17 16 x & y -#> 5 NA 4 16 17 16 x & y #> 1 1 1 11 11 13 x & y #> 2 1 2 12 11 13 x & y #> 3 2 1 13 15 14 x & y -#> 6 4 NA NA 16 15 y -#> 7 8 NA NA 18 17 y +#> 4 4 NA NA 16 15 y +#> 5 8 NA NA 18 17 y +#> 6 NA NA 15 17 16 x & y +#> 7 NA 4 16 17 16 x & y Updating values in common variables By setting update_values = TRUE, all values in x (both NAs and not) will be updated with the actual values of variables in y @@ -349,22 +346,22 @@ 2. Right join#> #> ── JOYn Report ── #> -#> right.joyn n percent -#> <char> <int> <char> -#> 1: x & y 5 71.4% -#> 2: y 2 28.6% -#> 3: total 7 100% +#> right.joyn n percent +#> 1 x 1 14.3% +#> 2 y 2 28.6% +#> 3 x & y 4 57.1% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable right.joyn -#> ℹ ❯ Removing key variables id from id, y, and t +#> ℹ Note: Joyn's report available in variable right.joyn +#> ℹ Note: Removing key variables id from id, y, and t #> id t.x x y t.y right.joyn -#> 4 NA NA 15 17 16 x & y -#> 5 NA 4 16 17 16 x & y #> 1 1 1 11 11 13 x & y #> 2 1 2 12 11 13 x & y #> 3 2 1 13 15 14 x & y -#> 6 4 NA NA 16 15 y -#> 7 8 NA NA 18 17 y +#> 4 4 NA NA 16 15 y +#> 5 8 NA NA 18 17 y +#> 6 NA NA 15 17 16 x & y +#> 7 NA 4 16 17 16 x & y 3. Full join @@ -381,24 +378,22 @@ 3. Full join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 33.3% -#> 2: x & y 3 50% -#> 3: y 1 16.7% -#> 4: total 6 100% +#> .joyn n percent +#> 1 x 2 33.3% +#> 2 y 1 16.7% +#> 3 x & y 3 50% +#> 4 total 6 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id.y, id, and y -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id.y, id, and y #> id t x id.y y .joyn -#> <num> <int> <int> <num> <num> <char> -#> 1: NA NA 15 NA NA x -#> 2: 1 1 11 1 11 x & y -#> 3: 1 2 12 1 11 x & y -#> 4: 2 1 13 2 15 x & y -#> 5: 3 2 14 NA NA x -#> 6: 4 NA NA 4 16 y +#> <num> <int> <int> <num> <num> <fctr> +#> 1: 1 1 11 1 11 x & y +#> 2: 1 2 12 1 11 x & y +#> 3: 2 1 13 2 15 x & y +#> 4: 3 2 14 NA NA x +#> 5: 4 NA NA 4 16 y +#> 6: NA NA 15 NA NA x 4. Inner join @@ -416,19 +411,20 @@ 4. Inner join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x & y 5 100% -#> 2: total 5 100% +#> .joyn n percent +#> 1 x 1 20% +#> 2 y 2 40% +#> 3 x & y 2 40% +#> 4 total 5 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, y, and t +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, y, and t #> id t.x x y t.y .joyn -#> 4 NA NA 15 17 16 x & y -#> 5 NA 4 16 17 16 x & y #> 1 1 1 11 11 13 x & y #> 2 1 2 12 11 13 x & y -#> 3 2 1 13 15 14 x & y +#> 3 2 1 13 15 14 x & y +#> 4 NA NA 15 17 16 x & y +#> 5 NA 4 16 17 16 x & y
Alternatively, you can specify to join by country
@@ -160,23 +158,21 @@ 1. Use variable co #> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 4 44.4% -#> 2: x & y 1 11.1% -#> 3: y 4 44.4% -#> 4: total 9 100% +#> .joyn n percent +#> 1 x 4 44.4% +#> 2 y 4 44.4% +#> 3 x & y 1 11.1% +#> 4 total 9 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables country from id, gdp, and country -#> Key: <country> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables country from id, gdp, and country #> id t country gdp .joyn -#> <num> <int> <num> <int> <char> -#> 1: 3 2 NA NA x -#> 2: 2 1 3 NA x -#> 3: 4 2 12 NA x -#> 4: NA NA 15 NA x -#> 5: 1 1 16 11 x & y +#> <num> <int> <num> <int> <fctr> +#> 1: 1 1 16 11 x & y +#> 2: 4 2 12 NA x +#> 3: 2 1 3 NA x +#> 4: 3 2 NA NA x +#> 5: NA NA 15 NA x #> 6: NA NA 17 15 y #> 7: NA NA 18 20 y #> 8: NA NA 19 13 y @@ -196,23 +192,21 @@ #> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 28.6% -#> 2: x & y 3 42.9% -#> 3: y 2 28.6% -#> 4: total 7 100% +#> .joyn n percent +#> 1 x 2 28.6% +#> 2 y 2 28.6% +#> 3 x & y 3 42.9% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, gdp, and country -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, gdp, and country #> id t country gdp .joyn -#> <num> <int> <num> <int> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 16 11 x & y +#> <num> <int> <num> <int> <fctr> +#> 1: 1 1 16 11 x & y +#> 2: 4 2 12 NA x #> 3: 2 1 3 15 x & y #> 4: 3 2 NA 10 x & y -#> 5: 4 2 12 NA x +#> 5: NA NA 15 NA x #> 6: 5 NA NA 20 y #> 7: 6 NA NA 13 y
Notice that if you set y_vars_to_keep = FALSE or diff --git a/docs/articles/aux-functions.html b/docs/articles/aux-functions.html index ba229364..3bfac999 100644 --- a/docs/articles/aux-functions.html +++ b/docs/articles/aux-functions.html @@ -26,7 +26,7 @@ joyn - 0.2.0 + 0.2.3 @@ -127,11 +127,10 @@ Verifying if dt is uniquely iden by = "id") #> #> ── Duplicates in terms of `id` -#> copies n percent -#> <char> <int> <char> -#> 1: 1 3 75% -#> 2: 2 1 25% -#> 3: total 4 100% +#> copies n percent +#> 1 1 3 75% +#> 2 2 1 25% +#> 3 total 4 100% #> ─────────────────────────────────────────────────────── End of is_id() report ── #> [1] FALSE @@ -142,11 +141,10 @@ Verifying if dt is uniquely iden return_report = FALSE) #> #> ── Duplicates in terms of `id` -#> copies n percent -#> <char> <int> <char> -#> 1: 1 3 75% -#> 2: 2 1 25% -#> 3: total 4 100% +#> copies n percent +#> 1 1 3 75% +#> 2 2 1 25% +#> 3 total 4 100% #> ─────────────────────────────────────────────────────── End of is_id() report ── #> [1] FALSE @@ -225,27 +223,24 @@ Tabulating simple frequencies# Tabulating frequencies of var `id` freq_table(x = x1, - byvar = "id") -#> id n percent -#> <char> <int> <char> -#> 1: <NA> 1 20% -#> 2: 1 2 40% -#> 3: 2 1 20% -#> 4: 3 1 20% -#> 5: total 5 100% + byvar = "id")[] +#> id n percent +#> 1 1 2 40% +#> 2 2 1 20% +#> 3 3 1 20% +#> 4 <NA> 1 20% +#> 5 total 5 100% # Removing NAs from the calculation freq_table(x = x1, byvar = "id", - na.rm = TRUE) -#> id n percent -#> <char> <int> <char> -#> 1: <NA> 1 20% -#> 2: 1 2 40% -#> 3: 2 1 20% -#> 4: 3 1 20% -#> 5: total 5 100% + na.rm = TRUE)[] +#> id n percent +#> 1 1 2 50% +#> 2 2 1 25% +#> 3 3 1 25% +#> 4 total 4 100% diff --git a/docs/articles/dplyr-joins.html b/docs/articles/dplyr-joins.html index 466facc7..94b24148 100644 --- a/docs/articles/dplyr-joins.html +++ b/docs/articles/dplyr-joins.html @@ -26,7 +26,7 @@ joyn - 0.2.0 + 0.2.3 @@ -151,22 +151,21 @@ Rationale#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 40% -#> 2: x & y 3 60% -#> 3: total 5 100% +#> .joyn n percent +#> 1 x 2 40% +#> 2 y 1 20% +#> 3 x & y 2 40% +#> 4 total 5 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id and y -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id and y #> id t x y .joyn -#> <num> <int> <int> <num> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 11 11 x & y -#> 3: 1 2 12 11 x & y -#> 4: 2 1 13 15 x & y -#> 5: 3 2 14 NA x +#> <num> <int> <int> <num> <fctr> +#> 1: 1 1 11 11 x & y +#> 2: 1 2 12 11 x & y +#> 3: 2 1 13 15 x & y +#> 4: 3 2 14 NA x +#> 5: NA NA 15 NA x # Option 2 @@ -176,24 +175,23 @@ Rationale#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 40% -#> 2: x & y 3 60% -#> 3: total 5 100% +#> .joyn n percent +#> 1 x 2 40% +#> 2 y 1 20% +#> 3 x & y 2 40% +#> 4 total 5 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id and y -#> ⚠ Warning: joyn does not currently allow inequality joins, so keep = NULL will +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id and y +#> ⚠ Warning: joyn does not currently allow inequality joins, so keep = NULL will #> retain only keys in x -#> Key: <id> #> id t x y .joyn -#> <num> <int> <int> <num> <char> -#> 1: NA NA 15 NA x -#> 2: 1 1 11 11 x & y -#> 3: 1 2 12 11 x & y -#> 4: 2 1 13 15 x & y -#> 5: 3 2 14 NA x +#> <num> <int> <int> <num> <fctr> +#> 1: 1 1 11 11 x & y +#> 2: 1 2 12 11 x & y +#> 3: 2 1 13 15 x & y +#> 4: 3 2 14 NA x +#> 5: NA NA 15 NA x # Option 3 @@ -255,22 +253,21 @@ 1. Left join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: NA updated 1 16.7% -#> 2: x 1 16.7% -#> 3: x & y 4 66.7% -#> 4: total 6 100% +#> .joyn n percent +#> 1 x 1 16.7% +#> 2 x & y 4 66.7% +#> 3 NA updated 1 16.7% +#> 4 total 6 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, y, and t +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, y, and t #> id t.x x y t.y .joyn -#> 5 NA 16 15 17 16 NA updated -#> 6 NA 4 16 17 16 x & y #> 1 1 1 11 11 13 x & y #> 2 1 2 12 11 13 x & y #> 3 2 1 13 15 14 x & y -#> 4 3 2 14 NA NA x +#> 4 3 2 14 NA NA x +#> 5 NA 16 15 17 16 NA updated +#> 6 NA 4 16 17 16 x & y Specifying which variables to keep from the right table after the join @@ -283,20 +280,20 @@ 1. Left join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 1 16.7% -#> 2: x & y 5 83.3% -#> 3: total 6 100% +#> .joyn n percent +#> 1 x 1 16.7% +#> 2 y 2 33.3% +#> 3 x & y 3 50% +#> 4 total 6 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn +#> ℹ Note: Joyn's report available in variable .joyn #> id t x y .joyn -#> 5 NA NA 15 17 x & y -#> 6 NA 4 16 17 x & y #> 1 1 1 11 11 x & y #> 2 1 2 12 11 x & y #> 3 2 1 13 15 x & y -#> 4 3 2 14 NA x +#> 4 3 2 14 NA x +#> 5 NA NA 15 17 x & y +#> 6 NA 4 16 17 x & y 2. Right join @@ -318,22 +315,22 @@ 2. Right join#> #> ── JOYn Report ── #> -#> right.joyn n percent -#> <char> <int> <char> -#> 1: x & y 5 71.4% -#> 2: y 2 28.6% -#> 3: total 7 100% +#> right.joyn n percent +#> 1 x 1 14.3% +#> 2 y 2 28.6% +#> 3 x & y 4 57.1% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable right.joyn -#> ℹ ❯ Removing key variables id from id, y, and t +#> ℹ Note: Joyn's report available in variable right.joyn +#> ℹ Note: Removing key variables id from id, y, and t #> id t.x x y t.y right.joyn -#> 4 NA NA 15 17 16 x & y -#> 5 NA 4 16 17 16 x & y #> 1 1 1 11 11 13 x & y #> 2 1 2 12 11 13 x & y #> 3 2 1 13 15 14 x & y -#> 6 4 NA NA 16 15 y -#> 7 8 NA NA 18 17 y +#> 4 4 NA NA 16 15 y +#> 5 8 NA NA 18 17 y +#> 6 NA NA 15 17 16 x & y +#> 7 NA 4 16 17 16 x & y Updating values in common variables By setting update_values = TRUE, all values in x (both NAs and not) will be updated with the actual values of variables in y @@ -349,22 +346,22 @@ 2. Right join#> #> ── JOYn Report ── #> -#> right.joyn n percent -#> <char> <int> <char> -#> 1: x & y 5 71.4% -#> 2: y 2 28.6% -#> 3: total 7 100% +#> right.joyn n percent +#> 1 x 1 14.3% +#> 2 y 2 28.6% +#> 3 x & y 4 57.1% +#> 4 total 7 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable right.joyn -#> ℹ ❯ Removing key variables id from id, y, and t +#> ℹ Note: Joyn's report available in variable right.joyn +#> ℹ Note: Removing key variables id from id, y, and t #> id t.x x y t.y right.joyn -#> 4 NA NA 15 17 16 x & y -#> 5 NA 4 16 17 16 x & y #> 1 1 1 11 11 13 x & y #> 2 1 2 12 11 13 x & y #> 3 2 1 13 15 14 x & y -#> 6 4 NA NA 16 15 y -#> 7 8 NA NA 18 17 y +#> 4 4 NA NA 16 15 y +#> 5 8 NA NA 18 17 y +#> 6 NA NA 15 17 16 x & y +#> 7 NA 4 16 17 16 x & y 3. Full join @@ -381,24 +378,22 @@ 3. Full join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 2 33.3% -#> 2: x & y 3 50% -#> 3: y 1 16.7% -#> 4: total 6 100% +#> .joyn n percent +#> 1 x 2 33.3% +#> 2 y 1 16.7% +#> 3 x & y 3 50% +#> 4 total 6 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id.y, id, and y -#> Key: <id> +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id.y, id, and y #> id t x id.y y .joyn -#> <num> <int> <int> <num> <num> <char> -#> 1: NA NA 15 NA NA x -#> 2: 1 1 11 1 11 x & y -#> 3: 1 2 12 1 11 x & y -#> 4: 2 1 13 2 15 x & y -#> 5: 3 2 14 NA NA x -#> 6: 4 NA NA 4 16 y +#> <num> <int> <int> <num> <num> <fctr> +#> 1: 1 1 11 1 11 x & y +#> 2: 1 2 12 1 11 x & y +#> 3: 2 1 13 2 15 x & y +#> 4: 3 2 14 NA NA x +#> 5: 4 NA NA 4 16 y +#> 6: NA NA 15 NA NA x 4. Inner join @@ -416,19 +411,20 @@ 4. Inner join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x & y 5 100% -#> 2: total 5 100% +#> .joyn n percent +#> 1 x 1 20% +#> 2 y 2 40% +#> 3 x & y 2 40% +#> 4 total 5 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn -#> ℹ ❯ Removing key variables id from id, y, and t +#> ℹ Note: Joyn's report available in variable .joyn +#> ℹ Note: Removing key variables id from id, y, and t #> id t.x x y t.y .joyn -#> 4 NA NA 15 17 16 x & y -#> 5 NA 4 16 17 16 x & y #> 1 1 1 11 11 13 x & y #> 2 1 2 12 11 13 x & y -#> 3 2 1 13 15 14 x & y +#> 3 2 1 13 15 14 x & y +#> 4 NA NA 15 17 16 x & y +#> 5 NA 4 16 17 16 x & y
y_vars_to_keep = FALSE
Specifying which variables to keep from the right table after the join
@@ -283,20 +280,20 @@ 1. Left join#> #> ── JOYn Report ── #> -#> .joyn n percent -#> <char> <int> <char> -#> 1: x 1 16.7% -#> 2: x & y 5 83.3% -#> 3: total 6 100% +#> .joyn n percent +#> 1 x 1 16.7% +#> 2 y 2 33.3% +#> 3 x & y 3 50% +#> 4 total 6 100% #> ────────────────────────────────────────────────────────── End of JOYn report ── -#> ℹ ❯ Joyn's report available in variable .joyn +#> ℹ Note: Joyn's report available in variable .joyn #> id t x y .joyn -#> 5 NA NA 15 17 x & y -#> 6 NA 4 16 17 x & y #> 1 1 1 11 11 x & y #> 2 1 2 12 11 x & y #> 3 2 1 13 15 x & y -#> 4 3 2 14 NA x
Updating values in common variables
By setting update_values = TRUE, all values in x (both NAs and not) will be updated with the actual values of variables in y @@ -349,22 +346,22 @@
update_values = TRUE