My data frame contains mostly catagorical columns and one numerical column, The df looks like this(simplified):
**Home_type** **Garden_type** **NaighbourhoOd** **Rent**
Vila big brooklyn 5000
Vila small bronx 7000
Condo shared Sillicon valley 2000
Appartment none brooklyn 500
Condo none bronx 1700
Appartment none Sillicon Valley 800
For every catagorical column, I want to display all its distinct values, frequency and sum of rent associated with it.
The result should look like this:
**Variable** **Distinct_values** **No_of-Occurences** **SUM_RENT**
Home_type Vila 2 12000
Home_type Condo 2 3700
Home_type Appartment 2 1300
Garden_type big 1 5000
Garden_type small 1 7000
Garden_type shared 1 2000
Garden_type none 3 3000
Naighbourhood brooklyn 2 5500
Naighbourhood Bronx 2 8700
Naighbourhood Sillicon Valley 2 2800
I'm new to R and have tried to do this using melt in reshape2 but havent had much success, any help will be much appreciated.