Comment Comment by educationdata The second example should be written like this: diamondsDT[cut != "Fair", .(AvgPrice = mean(price), MedianPrice = as.numeric(median(price)), Count = .N), cut][order(-Count)] There is no need to break it to 10 lines. parent educationdata 7 years ago