Problem: I want to mutate a new column (top_100k) that specifies values of 1 when rank == 1:100000. However, I am not sure how to expand the case_when() function in this way and if this is indeed appropriate.
It would results in something like the below.
rank top_100k
1 1
4 1
5 1
100001 0
This is my attempt so far
range <- 1:100000
df <- mutate(top_100k = case_when(rank >= range[1:100000] ~ 1))
Any help would be appreciated!