You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Another way, likely more useful when Trt contains NAs (parhaps more readable), is:
DT[, if("A" %in% Trt) sum(Dur), by=Id]
The (current) approach suggested by @MichaelChirico would fail if there is a group (in Id) that contains only NAs, or only NAs and values different from "A"; See data below (modified):
Hi
Would it be possible to add a function that evaluates any() in i by each group given by keyby or by. So instead of
the final line would be replaced by
DT(anyby(Trt=="A"),sum(Dur),by=Id)
The text was updated successfully, but these errors were encountered: