Fix for case 2 of bug #5149

Case where dcast.data.table(DT, x ~ ., mean) did not result in aggregated result when necessary. This is now fixed.
NEWS updated. Tests added and tested successfully.