Please...tell me how to deal with data for my purpose!

sfds

Hello, I urgently need some help.
This is my data imported by 'fread' function.
What I wanna do is reconstruct dataframe with 'id', 'floorspace summed by each ids', 'land_price averaged by each ids'. Variable 'zone' can be ignored right now.

Thus, I wanna transform this disaggregated data into more aggregated data, with the output whose data objects(=row) only exist 1539(right now there are 3613 rows because each id has several floorspace/land_price data)

I would be very appreciate if you give an advice to this newbie.

This sort of thing can be done with the functions in the dplyr package. If your data frame is named DF -

SummaryByID <- DF |> group_by(id) |> 
                  summarize(Total_floor = sum(floorspace), AvgPrice = mean(land_price))
1 Like

thank you so much. I solved this problem with your code

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.