Compare cf7c962 ... +0 ... 1987fa2

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.


@@ -1,4 +1,3 @@
Loading
1 -
#' @importFrom utils packageVersion
2 1
.onAttach <- function(...) {
3 2
4 3
  if (!interactive() || stats::runif(1) > 0.1) return()

@@ -65,7 +65,7 @@
Loading
65 65
      !! cust_id, date_most_recent, recency_days, transaction_count,
66 66
      amount
67 67
    ) %>%
68 -
    magrittr::set_names(c("customer_id", "date_most_recent", "recency_days", "transaction_count", "amount"))
68 +
    set_names(c("customer_id", "date_most_recent", "recency_days", "transaction_count", "amount"))
69 69
70 70
  result$recency_score   <- NA
71 71
  result$frequency_score <- NA

@@ -49,33 +49,33 @@
Loading
49 49
50 50
  ulm <-
51 51
    mapdata %>%
52 -
    magrittr::extract2("monetary") %>%
52 +
    extract2("monetary") %>%
53 53
    max() %>%
54 54
    ceiling(.)
55 55
56 56
  llm <-
57 57
    mapdata %>%
58 -
    magrittr::extract2("monetary") %>%
58 +
    extract2("monetary") %>%
59 59
    min() %>%
60 60
    floor(.)
61 61
62 62
  bins <-
63 63
    mapdata %>%
64 -
    magrittr::use_series(frequency_score) %>%
64 +
    use_series(frequency_score) %>%
65 65
    max()
66 66
67 67
  guide_breaks <-
68 68
    seq(llm, ulm, length.out = bins) %>%
69 69
    round()
70 70
71 71
  p <-
72 -
    ggplot2::ggplot(data = mapdata) +
73 -
    ggplot2::geom_tile(ggplot2::aes(x = frequency_score, y = recency_score, fill = monetary)) +
74 -
    ggplot2::scale_fill_gradientn(limits = c(llm, ulm),
72 +
    ggplot(data = mapdata) +
73 +
    geom_tile(aes(x = frequency_score, y = recency_score, fill = monetary)) +
74 +
    scale_fill_gradientn(limits = c(llm, ulm),
75 75
                         colours = RColorBrewer::brewer.pal(n = brewer_n, name = brewer_name),
76 76
                         name = legend_title) +
77 -
    ggplot2::ggtitle(plot_title) + ggplot2::xlab(xaxis_title) + ggplot2::ylab(yaxis_title) +
78 -
    ggplot2::theme(plot.title = ggplot2::element_text(hjust = plot_title_justify))
77 +
    ggtitle(plot_title) + xlab(xaxis_title) + ylab(yaxis_title) +
78 +
    theme(plot.title = element_text(hjust = plot_title_justify))
79 79
80 80
  if (print_plot) {
81 81
    print(p)
@@ -132,14 +132,14 @@
Loading
132 132
133 133
  p <-
134 134
    rfm_hist_data(rfm_table) %>%
135 -
    ggplot2::ggplot(ggplot2::aes(score)) +
136 -
    ggplot2::geom_histogram(bins = hist_bins, fill = hist_color) +
137 -
    ggplot2::ylab(yaxis_title) + ggplot2::ggtitle(plot_title) + ggplot2::xlab(xaxis_title) +
138 -
    ggplot2::facet_grid(. ~ rfm, scales = "free_x",
139 -
      labeller = ggplot2::labeller(
135 +
    ggplot(aes(score)) +
136 +
    geom_histogram(bins = hist_bins, fill = hist_color) +
137 +
    ylab(yaxis_title) + ggtitle(plot_title) + xlab(xaxis_title) +
138 +
    facet_grid(. ~ rfm, scales = "free_x",
139 +
      labeller = labeller(
140 140
        rfm = c(amount = hist_m_label, recency_days = hist_r_label,
141 141
                transaction_count = hist_f_label))) +
142 -
    ggplot2::theme(plot.title = ggplot2::element_text(hjust = plot_title_justify))
142 +
    theme(plot.title = element_text(hjust = plot_title_justify))
143 143
144 144
  if (print_plot) {
145 145
    print(p)
@@ -185,17 +185,17 @@
Loading
185 185
186 186
  p <-
187 187
    rfm_barchart_data(rfm_table) %>%
188 -
    ggplot2::ggplot() +
189 -
    ggplot2::geom_bar(ggplot2::aes(x = monetary_score), fill = bar_color) +
190 -
    ggplot2::facet_grid(recency_score ~ frequency_score) +
191 -
    ggplot2::scale_y_continuous(sec.axis = ggplot2::sec_axis(~ ., name = sec_yaxis_title)) +
192 -
    ggplot2::xlab(xaxis_title) + ggplot2::ylab(" ") + ggplot2::ggtitle(sec_xaxis_title) +
193 -
    ggplot2::theme(
194 -
      plot.title = ggplot2::element_text(
188 +
    ggplot() +
189 +
    geom_bar(aes(x = monetary_score), fill = bar_color) +
190 +
    facet_grid(recency_score ~ frequency_score) +
191 +
    scale_y_continuous(sec.axis = sec_axis(~ ., name = sec_yaxis_title)) +
192 +
    xlab(xaxis_title) + ylab(" ") + ggtitle(sec_xaxis_title) +
193 +
    theme(
194 +
      plot.title = element_text(
195 195
        face = "plain", size = 11, hjust = 0.5
196 196
      ),
197 -
      axis.text.y = ggplot2::element_blank(),
198 -
      axis.ticks.y = ggplot2::element_blank()
197 +
      axis.text.y = element_blank(),
198 +
      axis.ticks.y = element_blank()
199 199
    )
200 200
201 201
  if (print_plot) {
@@ -248,26 +248,26 @@
Loading
248 248
249 249
  data <-
250 250
    rfm_table %>%
251 -
    magrittr::use_series(rfm) %>%
251 +
    use_series(rfm) %>%
252 252
    dplyr::count(transaction_count)
253 253
254 254
  ylim_max <-
255 255
    data %>%
256 256
    dplyr::pull(n) %>%
257 257
    max() %>%
258 -
    magrittr::multiply_by(1.1) %>%
258 +
    multiply_by(1.1) %>%
259 259
    ceiling(.)
260 260
261 261
  p <-
262 262
    data %>%
263 -
    ggplot2::ggplot(ggplot2::aes(x = transaction_count, y = n)) +
264 -
    ggplot2::geom_bar(stat = "identity", fill = bar_color) +
265 -
    ggplot2::xlab(xaxis_title) + ggplot2::ylab(yaxis_title) + ggplot2::ylim(0, ylim_max) +
266 -
    ggplot2::ggtitle(plot_title) +
267 -
    ggplot2::geom_text(
268 -
      ggplot2::aes(label = n, y = n + 3), position = ggplot2::position_dodge(0.9), vjust = 0
263 +
    ggplot(aes(x = transaction_count, y = n)) +
264 +
    geom_bar(stat = "identity", fill = bar_color) +
265 +
    xlab(xaxis_title) + ylab(yaxis_title) + ylim(0, ylim_max) +
266 +
    ggtitle(plot_title) +
267 +
    geom_text(
268 +
      aes(label = n, y = n + 3), position = position_dodge(0.9), vjust = 0
269 269
    ) +
270 -
    ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5))
270 +
    theme(plot.title = element_text(hjust = 0.5))
271 271
272 272
  if (print_plot) {
273 273
    print(p)
@@ -316,10 +316,10 @@
Loading
316 316
317 317
  p <-
318 318
    rfm_table %>%
319 -
    magrittr::use_series(rfm) %>%
320 -
    ggplot2::ggplot() +
321 -
    ggplot2::geom_point(ggplot2::aes(x = amount, y = recency_days), color = point_color) +
322 -
    ggplot2::xlab(xaxis_title) + ggplot2::ylab(yaxis_title) + ggplot2::ggtitle(plot_title)
319 +
    use_series(rfm) %>%
320 +
    ggplot() +
321 +
    geom_point(aes(x = amount, y = recency_days), color = point_color) +
322 +
    xlab(xaxis_title) + ylab(yaxis_title) + ggtitle(plot_title)
323 323
324 324
  if (print_plot) {
325 325
    print(p)
@@ -339,10 +339,10 @@
Loading
339 339
340 340
  p <-
341 341
    rfm_table %>%
342 -
    magrittr::use_series(rfm) %>%
343 -
    ggplot2::ggplot() +
344 -
    ggplot2::geom_point(ggplot2::aes(x = amount, y = transaction_count), color = point_color) +
345 -
    ggplot2::xlab(xaxis_title) + ggplot2::ylab(yaxis_title) + ggplot2::ggtitle(plot_title)
342 +
    use_series(rfm) %>%
343 +
    ggplot() +
344 +
    geom_point(aes(x = amount, y = transaction_count), color = point_color) +
345 +
    xlab(xaxis_title) + ylab(yaxis_title) + ggtitle(plot_title)
346 346
347 347
  if (print_plot) {
348 348
    print(p)
@@ -362,10 +362,10 @@
Loading
362 362
363 363
  p <-
364 364
    rfm_table %>%
365 -
    magrittr::use_series(rfm) %>%
366 -
    ggplot2::ggplot() +
367 -
    ggplot2::geom_point(ggplot2::aes(x = transaction_count, y = recency_days), color = point_color) +
368 -
    ggplot2::xlab(xaxis_title) + ggplot2::ylab(yaxis_title) + ggplot2::ggtitle(plot_title)
365 +
    use_series(rfm) %>%
366 +
    ggplot() +
367 +
    geom_point(aes(x = transaction_count, y = recency_days), color = point_color) +
368 +
    xlab(xaxis_title) + ylab(yaxis_title) + ggtitle(plot_title)
369 369
370 370
  if (print_plot) {
371 371
    print(p)

@@ -57,7 +57,7 @@
Loading
57 57
  result <-
58 58
    data %>%
59 59
    dplyr::select(!! cust_id, !! n_recency, !! order_count, !! revenues) %>%
60 -
    magrittr::set_names(c("customer_id", "recency_days", "transaction_count", "amount"))
60 +
    set_names(c("customer_id", "recency_days", "transaction_count", "amount"))
61 61
62 62
  result$recency_score   <- NA
63 63
  result$frequency_score <- NA

@@ -42,7 +42,7 @@
Loading
42 42
43 43
  rfm_score_table <-
44 44
    data %>%
45 -
    magrittr::use_series(rfm) %>%
45 +
    use_series(rfm) %>%
46 46
    dplyr::mutate(segment = 1)
47 47
48 48
  n_segments <- length(segment_names)
@@ -109,19 +109,18 @@
Loading
109 109
    dplyr::group_by(segment) %>%
110 110
    dplyr::select(segment, recency_days) %>%
111 111
    dplyr::summarise(avg_recency = stats::median(recency_days)) %>%
112 -
    # dplyr::rename(segment = segment, avg_recency = `median(recency_days)`) %>%
113 112
    dplyr::arrange(avg_recency)
114 113
115 114
  n_fill <- nrow(data)
116 115
117 116
  p <-
118 -
    ggplot2::ggplot(data, ggplot2::aes(segment, avg_recency)) +
119 -
    ggplot2::geom_bar(stat = "identity", fill = ggthemes::calc_pal()(n_fill)) +
120 -
    ggplot2::xlab("Segment") + ggplot2::ylab("Median Recency") +
121 -
    ggplot2::ggtitle("Median Recency by Segment") +
122 -
    ggplot2::coord_flip() +
123 -
    ggplot2::theme(
124 -
      plot.title = ggplot2::element_text(hjust = 0.5)
117 +
    ggplot(data, aes(segment, avg_recency)) +
118 +
    geom_bar(stat = "identity", fill = ggthemes::calc_pal()(n_fill)) +
119 +
    xlab("Segment") + ylab("Median Recency") +
120 +
    ggtitle("Median Recency by Segment") +
121 +
    coord_flip() +
122 +
    theme(
123 +
      plot.title = element_text(hjust = 0.5)
125 124
    )
126 125
127 126
  if (print_plot) {
@@ -151,13 +150,13 @@
Loading
151 150
  n_fill <- nrow(data)
152 151
153 152
  p <-
154 -
    ggplot2::ggplot(data, ggplot2::aes(segment, avg_frequency)) +
155 -
    ggplot2::geom_bar(stat = "identity", fill = ggthemes::calc_pal()(n_fill)) +
156 -
    ggplot2::xlab("Segment") + ggplot2::ylab("Median Frequency") +
157 -
    ggplot2::ggtitle("Median Frequency by Segment") +
158 -
    ggplot2::coord_flip() +
159 -
    ggplot2::theme(
160 -
      plot.title = ggplot2::element_text(hjust = 0.5)
153 +
    ggplot(data, aes(segment, avg_frequency)) +
154 +
    geom_bar(stat = "identity", fill = ggthemes::calc_pal()(n_fill)) +
155 +
    xlab("Segment") + ylab("Median Frequency") +
156 +
    ggtitle("Median Frequency by Segment") +
157 +
    coord_flip() +
158 +
    theme(
159 +
      plot.title = element_text(hjust = 0.5)
161 160
    )
162 161
163 162
  if (print_plot) {
@@ -188,13 +187,13 @@
Loading
188 187
  n_fill <- nrow(data)
189 188
190 189
  p <-
191 -
    ggplot2::ggplot(data, ggplot2::aes(segment, avg_monetary)) +
192 -
    ggplot2::geom_bar(stat = "identity", fill = ggthemes::calc_pal()(n_fill)) +
193 -
    ggplot2::xlab("Segment") + ggplot2::ylab("Median Monetary Value") +
194 -
    ggplot2::ggtitle("Median Monetary Value by Segment") +
195 -
    ggplot2::coord_flip() +
196 -
    ggplot2::theme(
197 -
      plot.title = ggplot2::element_text(hjust = 0.5)
190 +
    ggplot(data, aes(segment, avg_monetary)) +
191 +
    geom_bar(stat = "identity", fill = ggthemes::calc_pal()(n_fill)) +
192 +
    xlab("Segment") + ylab("Median Monetary Value") +
193 +
    ggtitle("Median Monetary Value by Segment") +
194 +
    coord_flip() +
195 +
    theme(
196 +
      plot.title = element_text(hjust = 0.5)
198 197
    )
199 198
200 199
  if (print_plot) {

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

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/rfm-launch-shiny-app.R 0.00%
R/rfm-plots-data.R 87.10%
R/rfm-plots.R 93.40%
R/rfm-segment.R 96.20%
R/rfm-table-customer-2.R 98.61%
R/rfm-table-customer.R 98.57%
R/rfm-table-transaction.R 98.77%
R/utils.R 78.05%
R/zzz.R 4.76%
Project Totals (9 files) 88.69%
Loading