Instead of read.csv use fread function from data.table package it will read it faster and import it as a data.table you won't have to convert it.
Df[,.(totalsales = sum(amount),
Customer = unique(customerid)),
Item]
So on.... And you will be able to solve all your problem at once.