Skip to content

Commit

Permalink
Cut and Drop JRC_1K_POP_2018.tif
Browse files Browse the repository at this point in the history
  • Loading branch information
krausewe committed Mar 21, 2024
1 parent 50d9cb3 commit c0e7cca
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
Binary file removed vignettes/JRC_1K_POP_2018.tif
Binary file not shown.
Binary file added vignettes/JRC_1K_POP_2018_2016_transformed_NO.rds
Binary file not shown.
Binary file added vignettes/JRC_1K_POP_2018_2021_transformed_NO.rds
Binary file not shown.
Binary file added vignettes/JRC_1K_POP_2018_NO.rds
Binary file not shown.
25 changes: 15 additions & 10 deletions vignettes/nuts.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pat_n2_mhab_12_no <- pat_n2 %>%
filter(unit == "P_MHAB") %>% # Patents per one million inhabitants
filter(time == 2012) %>% # 2012
filter(str_detect(geo, "^NO")) %>% # Norway
select(-unit)
dplyr::select(-unit)
# Classifying the Data
pat_classified <- nuts_classify(
Expand Down Expand Up @@ -795,10 +795,10 @@ In addition to tracing the evolution of NUTS codes, the table contains **flows**
```{r, echo=FALSE, message = FALSE, warning = FALSE, fig.cap= "Alluvial plot illustrating area size flows; Created using the [ggalluvial](https://corybrunson.github.io/ggalluvial/) package.", fig.alt ="The alluvial plot shows population flows from NUTS version 2016 to 2021."}
# Add names
no_2016_names <- read_sf("shapefiles/NUTS_RG_20M_2016_3857_NO.shp") %>%
select(from_code = NUTS_ID, from_name = NUTS_NAME) %>%
dplyr::select(from_code = NUTS_ID, from_name = NUTS_NAME) %>%
st_set_geometry(NULL)
no_2021_names <- read_sf("shapefiles/NUTS_RG_20M_2021_3857_NO.shp") %>%
select(to_code = NUTS_ID, to_name = NUTS_NAME) %>%
dplyr::select(to_code = NUTS_ID, to_name = NUTS_NAME) %>%
st_set_geometry(NULL)
no_walks <- no_walks %>%
Expand Down Expand Up @@ -831,13 +831,18 @@ To illustrate the main idea, the map below showcases **population densities** ac

```{r, echo=FALSE, message = FALSE, warning = FALSE, out.width = "100%", fig.width = 7, fig.cap= "Spatial distribution of population and boundary changes; Sources: [Shapefiles](https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts) and [population raster](https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat) from EUROSTAT; Created using the [sf](https://r-spatial.github.io/sf/) and the [terra](https://rspatial.github.io/terra/reference/terra-package.html) packages.", fig.alt ="Two maps of Southern Norway with very granular population density and administrative boundaries of the 2016 and 2021 NUTS version. The region with the capital Olso and its adjacent region are highlighted in version 2016 that both contribute to a larger single region in version 2021."}
pop <- raster("JRC_1K_POP_2018.tif")
no_2016_1 <- no_2016 %>% st_transform(crs(pop))
no_2021_1 <- no_2021 %>% st_transform(crs(pop))
no_pop <- crop(x = pop, y = as_Spatial(no_2016_1))
no_pop <- mask(no_pop, as_Spatial(no_2016_1))
no_pop_df <- as.data.frame(no_pop, xy = TRUE) %>%
filter(!is.na(JRC_1K_POP_2018))
# pop <- raster("JRC_1K_POP_2018.tif")
# no_2016_1 <- no_2016 %>% st_transform(crs(pop))
# saveRDS( no_2016_1 , 'JRC_1K_POP_2018_2016_transformed_NO.rds' )
# no_2021_1 <- no_2021 %>% st_transform(crs(pop))
# saveRDS( no_2021_1 , 'JRC_1K_POP_2018_2021_transformed_NO.rds' )
# no_pop <- crop(x = pop, y = as_Spatial(no_2016_1))
# no_pop <- mask(no_pop, as_Spatial(no_2016_1))
# no_pop_df <- as.data.frame(no_pop, xy = TRUE) %>%
# filter(!is.na(JRC_1K_POP_2018))
no_pop_df <- readRDS( 'JRC_1K_POP_2018_NO.rds' )
no_2016_1 <- readRDS( 'JRC_1K_POP_2018_2016_transformed_NO.rds' )
no_2021_1 <- readRDS( 'JRC_1K_POP_2018_2021_transformed_NO.rds' )
c=500000
d=500000
Expand Down

0 comments on commit c0e7cca

Please sign in to comment.