Compare cea9631 ... +5 ... c51b34d

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -6,11 +6,11 @@
Loading
6 6
#' \code{dt_pivot_longer()}. Syntax based on the \code{tidyr} equivalents.
7 7
#'
8 8
#' @param dt_ the data table to widen
9 -
#' @param id_cols A set of columns that uniquely identifies each observation. Defaults to all columns in the data table except for the columns specified in `names_from` and `values_from`. Typically used when you have additional variables that is directly related.
10 -
#' @param names_from A pair of arguments describing which column (or columns) to get the name of the output column (`name_from`), and which column (or columns) to get the cell values from (`values_from`).
9 +
#' @param id_cols A set of columns that uniquely identifies each observation. Defaults to all columns in the data table except for the columns specified in \code{names_from} and \code{values_from}. Typically used when you have additional variables that is directly related.
10 +
#' @param names_from A pair of arguments describing which column (or columns) to get the name of the output column (\code{name_from}), and which column (or columns) to get the cell values from (\code{values_from}).
11 11
#' @param names_sep the separator between the names of the columns
12 -
#' @param values_from A pair of arguments describing which column (or columns) to get the name of the output column (`name_from`), and which column (or columns) to get the cell values from (`values_from`).
13 -
#' @param drop will cast by including all missing combinations. c(FALSE, TRUE) will only include all missing combinations of formula LHS; c(TRUE, FALSE) will only include all missing combinations of formula RHS.
12 +
#' @param values_from A pair of arguments describing which column (or columns) to get the name of the output column (\code{name_from}), and which column (or columns) to get the cell values from (\code{values_from}).
13 +
#' @param drop When \code{FALSE}, will cast by including all missing combinations. When \code{TRUE}, it is drop missing combination. \code{c(FALSE, TRUE)} will only include all missing combinations of formula LHS; \code{c(TRUE, FALSE)} will only include all missing combinations of formula RHS.
14 14
#'
15 15
#' @examples
16 16
#'
@@ -30,7 +30,7 @@
Loading
30 30
                           names_from,
31 31
                           names_sep = "_",
32 32
                           values_from,
33 -
                           drop = FALSE){
33 +
                           drop = TRUE){
34 34
  UseMethod("dt_pivot_wider", dt_)
35 35
}
36 36
@@ -40,7 +40,7 @@
Loading
40 40
                           names_from,
41 41
                           names_sep = "_",
42 42
                           values_from,
43 -
                           drop = FALSE) {
43 +
                           drop = TRUE) {
44 44
45 45
  is.data.frame(dt_) || is.data.table(dt_) || stop("data must be a data.frame or data.table")
46 46
@@ -66,18 +66,20 @@
Loading
66 66
  }
67 67
68 68
  if (length(id_cols) == 0) {
69 -
    dcast(dt_,
70 -
          formula = dcast_form,
71 -
          value.var = values_from,
72 -
          fun.aggregate = NULL,
73 -
          sep = names_sep,
74 -
          drop = drop)[, . := NULL][]
69 +
    dcast.data.table(
70 +
      dt_,
71 +
      formula = dcast_form,
72 +
      value.var = values_from,
73 +
      fun.aggregate = NULL,
74 +
      sep = names_sep,
75 +
      drop = drop)[, . := NULL][]
75 76
  } else {
76 -
    dcast(dt_,
77 -
          formula = dcast_form,
78 -
          value.var = values_from,
79 -
          fun.aggregate = NULL,
80 -
          sep = names_sep,
81 -
          drop = drop)
77 +
    dcast.data.table(
78 +
      dt_,
79 +
      formula = dcast_form,
80 +
      value.var = values_from,
81 +
      fun.aggregate = NULL,
82 +
      sep = names_sep,
83 +
      drop = drop)
82 84
  }
83 85
}

@@ -36,13 +36,21 @@
Loading
36 36
  n <- length(dots)
37 37
  conds <- conditions(dots)
38 38
  labels <- assigned_label(dots)
39 -
  class <- class(labels)
39 +
  class <- sapply(labels, typeof)
40 +
  if (length(unique(class)) > 1 && (! "symbol" %in% unique(class)))
41 +
    stop("The labels are of different types: ",
42 +
         paste(unique(class), collapse = ", "), call. = FALSE)
43 +
  class <- class[[1]]
40 44
41 45
  # make the right NA based on assigned labels
42 46
  na_type <- na_type_fun(class)
43 47
44 48
  # create fifelse() call
45 -
  calls <- call("fifelse", conds[[n]], labels[[n]], eval(na_type))
49 +
  if (isTRUE(conds[[n]])){
50 +
    calls <- labels[[n]]
51 +
  } else {
52 +
    calls <- call("fifelse", conds[[n]], labels[[n]], eval(na_type))
53 +
  }
46 54
  for (i in rev(seq_len(n))[-1]){
47 55
    calls <- call("fifelse", conds[[i]], labels[[i]], calls)
48 56
  }

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
R -0.81% 93.78%
src/fill.cpp 97.67%
Project Totals (12 files) 94.98%
Loading