I have created a dataframe which has three columns Name, Month and Amount . The format is such that there are mutiple names in each month and each combination has an amount . I want to find the top 5 users based on their monthly spending. Which means the final data in the data frame will have only top 5 earnings for each month . The way i have calculated the data now now is **
Extract_Month<- months(Credit$Transaction.Date)
Extract_Month
TopSpend<-aggregate(Credit$Amount,
by=list(Credit$User,Extract_Month)
, FUN=mean)
** I am stuck beyond this point . Please help
Here is some sample data
User<-c(6,2,3,4,5,6)
Transaction.Date<-c("11-1-2019","11-2-2019","11-3-2019",
"12-1-2019","12-2-2019","11-1-2019")
Amount<-c(100,200,300,400,500,150)
Credit<-data.frame(User,Transaction.Date,Amount)