dgrtwo / widyr

@@ -88,12 +88,14 @@
Loading
88 88
    if (!sparse) {
89 89
      if (!is.null(maximum_size)) {
90 90
        matrix_size <- (length(unique(tbl[[row]])) *
91 -
                        length(unique(tbl[[column]])))
91 +
                          length(unique(tbl[[column]])))
92 92
        if (matrix_size > maximum_size) {
93 -
          stop("Size of acast matrix, ", matrix_size,
94 -
               " will be too large. Set maximum_size = NULL to avoid ",
95 -
               "this error (make sure your memory is sufficient), ",
96 -
               "or consider using sparse = TRUE.")
93 +
          rlang::abort(
94 +
            paste0("Size of acast matrix, ", matrix_size,
95 +
                   " will be too large. Set maximum_size = NULL to avoid ",
96 +
                   "this error (make sure your memory is sufficient), ",
97 +
                   "or consider using sparse = TRUE.")
98 +
          )
97 99
        }
98 100
      }
99 101
@@ -101,7 +103,7 @@
Loading
101 103
102 104
      input <- reshape2::acast(tbl, form, value.var = value, fill = 0)
103 105
    } else {
104 -
      input <- tidytext::cast_sparse_(tbl, row, column, value)
106 +
      input <- tidytext::cast_sparse(tbl, !!row, !!column, !!value)
105 107
    }
106 108
    output <- purrr::as_mapper(.f)(input, ...)
107 109
@@ -123,7 +125,7 @@
Loading
123 125
#' @noRd
124 126
custom_melt <- function(m) {
125 127
  if (inherits(m, "data.frame")) {
126 -
    stop("Output is a data frame: don't know how to fix")
128 +
    rlang::abort("Output is a data frame: don't know how to fix")
127 129
  }
128 130
  if (inherits(m, "matrix")) {
129 131
    ret <- reshape2::melt(m, varnames = c("item1", "item2"), as.is = TRUE)

@@ -19,12 +19,12 @@
Loading
19 19
#' @examples
20 20
#'
21 21
#' library(dplyr)
22 -
#' dat <- data_frame(group = rep(1:5, each = 2),
23 -
#'                   letter = c("a", "b",
24 -
#'                              "a", "c",
25 -
#'                              "a", "c",
26 -
#'                              "b", "e",
27 -
#'                              "b", "f"))
22 +
#' dat <- tibble(group = rep(1:5, each = 2),
23 +
#'               letter = c("a", "b",
24 +
#'                          "a", "c",
25 +
#'                          "a", "c",
26 +
#'                          "b", "e",
27 +
#'                          "b", "f"))
28 28
#'
29 29
#' # count the number of times two letters appear together
30 30
#' pairwise_count(dat, letter, group)

@@ -22,12 +22,12 @@
Loading
22 22
#'
23 23
#' library(dplyr)
24 24
#'
25 -
#' dat <- data_frame(group = rep(1:5, each = 2),
26 -
#'                   letter = c("a", "b",
27 -
#'                              "a", "c",
28 -
#'                              "a", "c",
29 -
#'                              "b", "e",
30 -
#'                              "b", "f"))
25 +
#' dat <- tibble(group = rep(1:5, each = 2),
26 +
#'               letter = c("a", "b",
27 +
#'                          "a", "c",
28 +
#'                          "a", "c",
29 +
#'                          "b", "e",
30 +
#'                          "b", "f"))
31 31
#'
32 32
#' # how informative is each letter about each other letter
33 33
#' pairwise_pmi(dat, letter, group)
Files Coverage
R 65.57%
Project Totals (11 files) 65.57%
Notifications are pending CI completion. Waiting for GitHub's status webhook to queue notifications. Push notifications now.
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading