I have the following table
DT = data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=rep(4:6, 3))
y==3 & v==5
.N
require(data.table)
keycols = c("y","v")
setkeyv(DT,keycols)
DT[J(3,5)] # This gets the subset I am interested in
DT[ , `:=` (count = .N), by = J(3,5)] # This is one of the multiple unsuccessful ways I have been trying to count the rows.
How about just
DT[.(3,5), .N]
# [1] 3
## These are also equivalent
## DT[J(3,5), .N]
## DT[list(3,5), .N]