Hello Serder,
I'm most comfortable using the data.table package. And if I'm understanding what you're after, I would do the dcast and then filter like this:
dat <- as.data.table(dat)
upper_95 <- quantile(dat$TVolume, 0.95)
lower_95 <- quantile(dat$TVolume, 0.05)
dat <- dat[TVolume %between% c(l_95, u_95), ]
Yet maybe that's not what you're after.
Cheers,
Corey