I have the following generated dataframe
df = data.frame(yearr = sample(2015:2021, 2000, replace = TRUE),
monthh = sample(1:12, 2000, replace = TRUE),
dayy = sample(1:29, 2000, replace = TRUE)) |>
mutate(datee = ymd(paste(yearr, monthh, dayy)),
yy = sample(0:100, 2000, replace = TRUE) + (130 * yearr) + (2 * monthh)) |>
filter(!is.na(datee)) |>
arrange(-desc(datee)) |>
mutate(ii = row_number()) |>
distinct(datee, .keep_all = TRUE)
I would like to find out the proportion of data where a certain date would be.
certain_date = ymd('2017-05-15')
percent_rank(df[['datee']] > promo_start) # or df$datee
It gives me vector(s) of outputs instead of a single value. How do I make it return single value?