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.