This uses ave to group by each value. This would likely be better if your vector is definitely an integer type. x <- c(1,1,1,1,2) ave(x, x, FUN = length) ...
確定! 回上一頁