I have the following hypothetical dataframe
Region <- c("District A", "District B","District A","District A","District B")
Gender <- c("Male","Male","Female", "Male","Female")
Age <- c(20, 21, 23, 34, 22)
AmountSold <- c(50, 10, 20, 4, 12)
RegionSales <- data.frame(Region, Gender, Age, AmountSold)
I'd like to create a pivot table or a table that shows both mean of Amount sold per gender and Region as well as the mean of Age per gender and region. How do I do that in R?