Created
October 6, 2017 17:35
-
-
Save nstrayer/6b57760c2d089c2d2c281e2393d405a7 to your computer and use it in GitHub Desktop.
This file contains 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
library(tidyverse) | |
data_frame( | |
x = 1:100, | |
y = rnorm(100) | |
) %>% | |
mutate( y_quartile = ntile(y, 4) ) %>% | |
head(5) | |
# # A tibble: 5 x 3 | |
# x y y_quartile | |
# <int> <dbl> <int> | |
# 1 1 -0.8521091 1 | |
# 2 2 -2.2174697 1 | |
# 3 3 1.1815976 4 | |
# 4 4 0.9591009 4 | |
# 5 5 -0.4436867 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment