Created
December 27, 2016 18:31
-
-
Save apinstein/917346f203b68d06df7a19e4ed52a2f5 to your computer and use it in GitHub Desktop.
Revisions
-
apinstein renamed this gist
Dec 27, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
apinstein created this gist
Dec 27, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ is_established_customerF <- function(customer_segment, credits_purchased) { print(typeof(customer_segment)) # prints only once? established_customer_threshold <- 100000000 # infinitely large customer_segment <- as.character(customer_segment) if (customer_segment == "multiple_photographer_company") { established_customer_threshold <- 3000 } else if (customer_segment == "in_house_photography_department") { established_customer_threshold <- 1000 } else if (customer_segment == "full_time_single_re_photographer") { established_customer_threshold <- 1000 } else if (customer_segment == "part_time_single_re_photographer") { print("matched PT") established_customer_threshold <- 350 } else if (customer_segment == "real_estate_agent") { print("matched RE") established_customer_threshold <- 150 } # prints N times? print(paste(customer_segment, credits_purchased, ">", established_customer_threshold, credits_purchased > established_customer_threshold)) return(credits_purchased > established_customer_threshold) } data[1:50][is_established_customerF(customer_segment, tx_cum_amount) == TRUE] ### output ### expect the `established_customer_threshold` to be different for these rows... [20] "real_estate_agent 300 > 150 TRUE" [21] "full_time_single_re_photographer NA > 150 NA"