diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 52c2b27..d295d9e 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -29,7 +29,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -41,9 +41,13 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::rcmdcheck + extra-packages: | + any::rcmdcheck + ggraph=?ignore-before-r=4.5.0 needs: check - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true + env: + _R_CHECK_FORCE_SUGGESTS_: false diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 0b26021..94604d4 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -20,7 +20,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -39,7 +39,7 @@ jobs: - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@4.1.4 + uses: JamesIves/github-pages-deploy-action@v4 with: clean: false branch: gh-pages diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 4b65418..d9d5c3d 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -15,7 +15,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-r@v2 with: diff --git a/DESCRIPTION b/DESCRIPTION index 7c26558..eb32ab6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -47,4 +47,4 @@ VignetteBuilder: Encoding: UTF-8 LazyData: TRUE Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.1 +RoxygenNote: 7.3.3 diff --git a/NEWS.md b/NEWS.md index 79050b7..75b502f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # widyr (development version) * Now force evaluation for `widely()` function factory (thanks to @lhdjung, #44) +* Explain how to handle zero-similarity pairs in `pairwise_similarity()` (#47) # widyr 0.1.5 diff --git a/R/pairwise_similarity.R b/R/pairwise_similarity.R index 5f322cc..71d95a8 100644 --- a/R/pairwise_similarity.R +++ b/R/pairwise_similarity.R @@ -2,6 +2,12 @@ #' #' Compute cosine similarity of all pairs of items in a tidy table. #' +#' @details +#' This function uses sparse matrices internally for efficiency, which means +#' pairs with zero similarity are excluded from the output. To include +#' zero-similarity pairs, use [tidyr::complete()] on your result: +#' `complete(item1, item2, fill = list(similarity = 0))`. +#' #' @param tbl Table #' @param item Item to compare; will end up in `item1` and #' `item2` columns diff --git a/man/pairwise_similarity.Rd b/man/pairwise_similarity.Rd index 524d684..9c93b73 100644 --- a/man/pairwise_similarity.Rd +++ b/man/pairwise_similarity.Rd @@ -25,6 +25,12 @@ such as \code{diag} and \code{upper}} \description{ Compute cosine similarity of all pairs of items in a tidy table. } +\details{ +This function uses sparse matrices internally for efficiency, which means +pairs with zero similarity are excluded from the output. To include +zero-similarity pairs, use \code{\link[tidyr:complete]{tidyr::complete()}} on your result: +\code{complete(item1, item2, fill = list(similarity = 0))}. +} \examples{ library(janeaustenr)