00_10

 avatar
unknown
r
4 years ago
1.9 kB
7
Indexable
source_units <- dat00[, c("GISJOIN", list_race, "POP")]
colnames(source_units) <- c("GJOIN", list_race, "POP", "geometry")
intersect <- aw_intersect(target_units, 
                          source = source_units, 
                          areaVar = "area") 
intersect <- aw_total(intersect, 
                      source = source_units, #granice zrodlowe
                      id = GJOIN, #id jednostek zrodlowych
                      areaVar = "area", #nazwa pola z powierzchnia jednostek z przeciecia, Ai
                      totalVar = "totalArea",  
                      type = "extensive", 
                      weight = "sum") 
intersect <- aw_weight(intersect, 
                       areaVar = "area", #Ai - obliczane przez aw_intersect
                       totalVar = "totalArea", #Aj, obliczane przez aw_total
                       areaWeight = "areaWeight")
intersect <- aw_calculate(intersect, 
                          value = "POP", #kolumna do przeliczenia
                          newVar = "POPnew", #nazwa nowej kolumny z przeliczonymi danymi. 
                          areaWeight = "areaWeight")
result <- aw_aggregate(intersect, 
                       target = target_units, #granice docelowe
                       tid = GISJOIN, #id docelowe (target units)
                       interVar = "POPnew") #nazwa przeliczonej zmiennej

result00_10 <- aw_interpolate(target_units, #granice jednostek docelowych (target_units)
                              tid = GISJOIN, #id jednostek docelowych
                              source = source_units, #dane zrodlowe
                              sid = GJOIN, #id jednostek zrodlowych (source units)
                              weight = "sum", 
                              output = "tibble", #wynik w jako tabela, moze tez być obiekt sf
                              extensive = list_race) #lista zmiennych do przeliczenia
Editor is loading...