Displaying 1 result from an estimated 1 matches for "med_totq".
2011 Jun 23
1
else problem
...are an even number of data, I cannot use 'median' directly since it gives me a non-existent year/discharge. I found a way to get around that with the following:
md <- dat2f[, list(med_year = max(year[which(abs(tot_km3y - median(tot_km3y)) == min(abs(tot_km3y - median(tot_km3y)))) ]), med_TotQ = median(tot_km3y))]
(I really only need the year, not the actual discharge with that year, which is why I left med_TotQ as the true median)
However, I have some data sets that have an odd number of data for which the following works perfectly:
md <-dat2f[, list(med_year = year[which(tot_km3...