-
Notifications
You must be signed in to change notification settings - Fork 0
/
java.R
33 lines (26 loc) · 904 Bytes
/
java.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Title: Java Island Boundary Generation
# Author: Andi Herlan
# Email: [email protected]
# Data Used: https://www.naturalearthdata.com/downloads/ (using pkg)
# Packages Used: rnaturalearth, rnaturalearthdata, sf, dplyr
# Output File: -
# Data Output: java.rds
library(rnaturalearth)
library(rnaturalearthdata)
library(sf)
library(dplyr)
idn <- ne_countries(returnclass = "sf",
country = "indonesia",
scale = 50)
print(t(as.data.frame(idn)))
java <- st_cast(idn, "POLYGON") %>%
mutate(id = 1:n()) %>%
select(id, name) %>%
filter(id %in% c(31, 38))
island <- tribble(~id, ~island, 31, "Madura", 38, "Jawa") %>%
mutate(scale = 50, source = "Natural Earth")
java <- java %>%
left_join(island, by = "id") %>%
select(-id) %>%
rename("country" = "name")
saveRDS(java, "output/java.rds")