I have an sf
class object, where there are some polygons:
id use_type area
1 housing 100
1 farming 200
2 farming 150
2 forest 100
3 housing 250
Polygons with same id
value have same geometry. There are also fields use_type
and area
: first is a name of landuse type within the polygon borders, the second is an area of this landuse type within the polygon borders. So every duplicate geometries containes info about single landuse type, but I want to eliminate duplicates and have this information about landuse types in columns, each representing info about area of a specific landuse type, not different polygons. Like this:
id housing_area farming_area forest_area
1 100 200 NULL
2 NULL 150 100
3 250 NULL NULL
How can I do this?