From b8f90c5d9f06e03012fcf181824b43ff9bd9bdd7 Mon Sep 17 00:00:00 2001 From: rsquaredin Date: Wed, 11 Apr 2018 20:50:07 +0530 Subject: [PATCH 1/5] test on R 3.2 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2272e267..71af52b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ warnings_are_errors: true sudo: false r: + - 3.2 - oldrel - release - devel From dcfa5479521de4109dd9845f6f24136906e694be Mon Sep 17 00:00:00 2001 From: rsquaredin Date: Thu, 12 Apr 2018 08:28:54 +0530 Subject: [PATCH 2/5] test on R 3.1 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 71af52b9..21b90e83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ warnings_are_errors: true sudo: false r: + - 3.1 - 3.2 - oldrel - release From ba718ee702ed3891456f52b2dd3da84d385a846e Mon Sep 17 00:00:00 2001 From: rsquaredin Date: Thu, 12 Apr 2018 13:20:25 +0530 Subject: [PATCH 3/5] change R depends version --- .travis.yml | 1 - DESCRIPTION | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21b90e83..71af52b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ warnings_are_errors: true sudo: false r: - - 3.1 - 3.2 - oldrel - release diff --git a/DESCRIPTION b/DESCRIPTION index 247b4356..90931812 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,7 +13,7 @@ License: MIT + file LICENSE URL: https://github.com/rsquaredacademy/rfm, https://rfm.rsquaredacademy.com/ BugReports: https://github.com/rsquaredacademy/rfm/issues Depends: - R (>= 3.2.4) + R (>= 3.2) Imports: assertthat, dplyr, From dc2e7080503cc6ce022419013a56ab20752a20ca Mon Sep 17 00:00:00 2001 From: rsquaredin Date: Sat, 21 Apr 2018 21:43:31 +0530 Subject: [PATCH 4/5] language override --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..0a5d9816 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* linguist-vendored +*.R linguist-vendored=false From 56fff1f220e7d2019ddb84ad7db772b1c1927703 Mon Sep 17 00:00:00 2001 From: rsquaredin Date: Fri, 4 May 2018 14:39:38 +0530 Subject: [PATCH 5/5] fix app --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ inst/application/logic/logic_segments.R | 31 ++++++++++++++----------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 90931812..18df961f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: rfm Title: Recency, Frequency and Monetary Value Analysis -Version: 0.1.0 +Version: 0.1.1 Authors@R: person("Aravind", "Hebbali", email = "hebbali.aravind@gmail.com", role = c("aut", "cre")) Description: Tools for RFM (recency, frequency and monetary value) analysis. Generate RFM score from both transaction and customer level data. Visualize the diff --git a/NEWS.md b/NEWS.md index ef70687e..65eca5b7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# rfm 0.1.1 + +Patch release to fix the shiny app. + # rfm 0.1.0 This is a minor release for bug fixes and enhancements. diff --git a/inst/application/logic/logic_segments.R b/inst/application/logic/logic_segments.R index c8110b6f..51e7d3f2 100644 --- a/inst/application/logic/logic_segments.R +++ b/inst/application/logic/logic_segments.R @@ -33,7 +33,7 @@ output$segment_prep <- renderUI({ }) segment_names <- reactive({ - + ncol <- as.integer(input$n_segments) collect <- list(lapply(1:ncol, function(i) { @@ -114,22 +114,24 @@ monetary_upper <- reactive({ ncol <- as.integer(input$n_segments) collect <- list(lapply(1:ncol, function(i) { + input[[paste("monetary_interval_", i)]] })) collect[[1]] %>% + map_int(2) }) prep_segment <- eventReactive(input$button_create_segments, { - rfm_score_table <- - comp_rfm_score() %>% - use_series(rfm) + rfm_score_table <- + rfm_final_score$a %>% + use_series(rfm) for (i in seq_len(input$n_segments)) { - rfm_score_table$segment[((rfm_score_table$recency_score %>% between(recency_lower()[i], recency_upper()[i])) & + rfm_score_table$segment[((rfm_score_table$recency_score %>% between(recency_lower()[i], recency_upper()[i])) & (rfm_score_table$frequency_score %>% between(frequency_lower()[i], frequency_upper()[i])) & (rfm_score_table$monetary_score %>% between(monetary_lower()[i], monetary_upper()[i])))] <- segment_names()[i] } @@ -140,12 +142,13 @@ prep_segment <- eventReactive(input$button_create_segments, { select( customer_id, segment, rfm_score, transaction_count, recency_days, amount + ) }) output$segment_out <- renderDataTable({ - prep_segment() + prep_segment() }) output$segment_size_out <- renderPrint({ @@ -153,7 +156,7 @@ output$segment_size_out <- renderPrint({ prep_segment() %>% count(segment) %>% arrange(desc(n)) %>% - rename(Segment = segment, Count = n) %>% + rename(Segment = segment, Count = n) %>% kable() %>% kable_styling(full_width = TRUE, font_size = 30) @@ -165,13 +168,13 @@ fill_segments <- reactive({ output$segment_average_recency <- renderPlot({ - data <- + data <- prep_segment() %>% group_by(segment) %>% select(segment, recency_days) %>% summarize(median(recency_days)) %>% rename(segment = segment, avg_recency = `median(recency_days)`) %>% - arrange(avg_recency) + arrange(avg_recency) n_fill <- nrow(data) @@ -188,13 +191,13 @@ output$segment_average_recency <- renderPlot({ output$segment_average_frequency <- renderPlot({ - data <- + data <- prep_segment() %>% group_by(segment) %>% select(segment, transaction_count) %>% summarize(median(transaction_count)) %>% rename(segment = segment, avg_frequency = `median(transaction_count)`) %>% - arrange(avg_frequency) + arrange(avg_frequency) n_fill <- nrow(data) @@ -211,13 +214,13 @@ output$segment_average_frequency <- renderPlot({ output$segment_average_monetary <- renderPlot({ - data <- + data <- prep_segment() %>% group_by(segment) %>% select(segment, amount) %>% summarize(median(amount)) %>% rename(segment = segment, avg_monetary = `median(amount)`) %>% - arrange(avg_monetary) + arrange(avg_monetary) n_fill <- nrow(data) @@ -230,4 +233,4 @@ output$segment_average_monetary <- renderPlot({ plot.title = element_text(hjust = 0.5) ) -}) \ No newline at end of file +})