Created
June 5, 2018 20:35
-
-
Save alexhallam/8881ff662595b7cfb57f3e80f0efd91e to your computer and use it in GitHub Desktop.
Test Train Split In dplyr with mutate
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
# Test/Train split | |
set.seed(2018) # for reproducability | |
daily %>% | |
mutate(test_train = ifelse(rbinom(n=n(), size = 1, prob = .75) == 1, | |
"train","test")) %>% | |
count(test_train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment