I want to calculate the 5%, 25%, 50%, 75% and 95% quantiles (percentiles) for my data.table for every datetime (yellow). So I get five values for every time in a day.
quantile(dt.data, c(.05, .25, .5, .75, .95))
but I get this Error: Error in
[.data.frame(x, i) : undefined columns selected
Maybe I have to use something like this:
out <- dt.data[ ,lapply(.SD, quantile, prob = c(.05, .25, .5, .75, .95), na.rm = TRUE), by = c("date")]