tidyverse / dtplyr

@@ -53,3 +53,9 @@
Loading
53 53
  out <- step_colorder(.data, new_vars)
54 54
  step_group(out, .data$groups)
55 55
}
56 +
57 +
#' @export
58 +
relocate.data.table <- function(.data, ..., .before = NULL, .after = NULL) {
59 +
  .data <- lazy_dt(.data)
60 +
  relocate(.data, ..., .before = {{ .before }}, .after = {{ .after }})
61 +
}

@@ -131,6 +131,7 @@
Loading
131 131
    quote(.I)
132 132
  } else if (is_call(x, "desc")) {
133 133
    x[[1]] <- sym("-")
134 +
    x[[2]] <- get_expr(x[[2]])
134 135
    x
135 136
  } else if (is_call(x, "if_else") || is_call(x, "ifelse")) {
136 137
    x[[1L]] <- quote(fifelse)

@@ -28,3 +28,9 @@
Loading
28 28
  step <- step_subset(.data, i = call2("order", !!!dots), groups = character())
29 29
  step_group(step, groups = .data$groups)
30 30
}
31 +
32 +
#' @export
33 +
arrange.data.table <- function(.data, ..., .by_group = FALSE) {
34 +
  .data <- lazy_dt(.data)
35 +
  arrange(.data, ..., .by_group = .by_group)
36 +
}

@@ -86,6 +86,12 @@
Loading
86 86
  step_subset_i(.data, i = i)
87 87
}
88 88
89 +
#' @export
90 +
slice_head.data.table <- function(.data, ..., n, prop) {
91 +
  .data <- lazy_dt(.data)
92 +
  slice_head(.data, ..., n = n, prop = prop)
93 +
}
94 +
89 95
#' @rdname slice.dtplyr_step
90 96
#' @importFrom dplyr slice_tail
91 97
#' @export
@@ -99,6 +105,12 @@
Loading
99 105
  step_subset_i(.data, i = expr(seq.int(.N - !!n_sequence + 1, .N)))
100 106
}
101 107
108 +
#' @export
109 +
slice_tail.data.table <- function(.data, ..., n, prop) {
110 +
  .data <- lazy_dt(.data)
111 +
  slice_tail(.data, ..., n = n, prop = prop)
112 +
}
113 +
102 114
#' @rdname slice.dtplyr_step
103 115
#' @importFrom dplyr slice_min
104 116
#' @inheritParams dplyr::slice
@@ -110,7 +122,7 @@
Loading
110 122
111 123
  slice_min_max(
112 124
    .data,
113 -
    order_by = enexpr(order_by),
125 +
    order_by = {{ order_by }},
114 126
    decreasing = FALSE,
115 127
    ...,
116 128
    n =  n,
@@ -119,6 +131,12 @@
Loading
119 131
  )
120 132
}
121 133
134 +
#' @export
135 +
slice_min.data.table <- function(.data, order_by, ..., n, prop, with_ties = TRUE) {
136 +
  .data <- lazy_dt(.data)
137 +
  slice_min(.data, {{ order_by }}, ..., n = n, prop = prop, with_ties = with_ties)
138 +
}
139 +
122 140
#' @rdname slice.dtplyr_step
123 141
#' @importFrom dplyr slice_max
124 142
#' @export
@@ -129,7 +147,7 @@
Loading
129 147
130 148
  slice_min_max(
131 149
    .data,
132 -
    order_by = enexpr(order_by),
150 +
    order_by = {{ order_by }},
133 151
    decreasing = TRUE,
134 152
    ...,
135 153
    n =  n,
@@ -138,10 +156,18 @@
Loading
138 156
  )
139 157
}
140 158
159 +
#' @export
160 +
slice_max.data.table <- function(.data, order_by, ..., n, prop, with_ties = TRUE) {
161 +
  .data <- lazy_dt(.data)
162 +
  slice_max(.data, {{ order_by }}, ..., n = n, prop = prop, with_ties = with_ties)
163 +
}
164 +
141 165
slice_min_max <- function(.data, order_by, decreasing, ..., n, prop, with_ties = TRUE) {
142 166
  ellipsis::check_dots_empty()
143 167
  size <- check_slice_size(n, prop)
144 168
169 +
  order_by <- capture_dot(.data, {{ order_by }}, j = FALSE)
170 +
145 171
  if (decreasing) {
146 172
    order_by <- expr(desc(!!order_by))
147 173
  }
@@ -188,6 +214,12 @@
Loading
188 214
  step_subset_i(.data, i)
189 215
}
190 216
217 +
#' @export
218 +
slice_sample.data.table <- function(.data, ..., n, prop, weight_by = NULL, replace = FALSE) {
219 +
  .data <- lazy_dt(.data)
220 +
  slice_sample(.data, ..., n = n, prop = prop, weight_by = !!enexpr(weight_by), replace = replace)
221 +
}
222 +
191 223
sample_int <- function(n, size, replace = FALSE, wt = NULL) {
192 224
  n <- enexpr(n)
193 225
  size <- enexpr(size)
Files Coverage
R 92.76%
Project Totals (29 files) 92.76%
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
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