Created
December 23, 2015 14:28
-
-
Save daynebatten/820bb41c4c01611410ff to your computer and use it in GitHub Desktop.
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 characters
# We'll have two "chunks" for customer 1. | |
# One for customer 2 | |
id <- c(1, 1, 2) | |
# Customer 1's first chunk starts at day 0, | |
# his second at day 500. Customer 2 starts at day 0. | |
start_time <- c(0, 500, 0) | |
# Customer 1's first chunk ends at day 499. | |
#Both customer's final chunks end at day 1000. | |
end_time <- c(499, 1000, 1000) | |
# Customer 1 hadn't contacted support by day 499, | |
# but he did on day 500. Customer 2 never did. | |
contacted_support <- c(0, 1, 0) | |
# For some reason, since "churned" was used in the | |
# cox model, we have to put a placeholder here... | |
churned <- c(0, 0, 0) | |
# Put it all in one data frame | |
new_values <- cbind( | |
data.frame(start_time), | |
data.frame(end_time), | |
data.frame(contacted_support), | |
data.frame(churned), | |
data.frame(id) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment