Skip to content

Commit

Permalink
Actualitza codi de tesaurus_comarques i codi per desar taules en ods …
Browse files Browse the repository at this point in the history
…i xlsx

monitorOSM ja inclou Fenolhedés
  • Loading branch information
jmaspons committed Nov 28, 2024
1 parent 06f95a4 commit 32b5221
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions data-raw/tesaurus_comarques.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,31 @@ comarques_osm <- comarques_osm[, c("name:ca", "osm_type", "osm_id")]
names(comarques_osm) <- gsub("^name:ca$", "osm_name", names(comarques_osm))

tesaurus_comarques <- data.frame(
becat_nom = grep(" |^Fenolhedés", comarques_becat, value = TRUE, invert = TRUE),
comarques_osm[c(2, 1, 3:5), ]
becat_nom = grep(" ", comarques_becat, value = TRUE, invert = TRUE),
comarques_osm[c(2, 1, 3:6), ]
)

pendents <- setdiff(comarques_becat, tesaurus_comarques$becat_nom)
pendents <- c(pendents, pendents[2])
pendents <- data.frame(becat_nom = pendents, rbind(rep(NA, ncol(comarques_osm)), comarques_osm[4:5, ]))
pendents <- rep(pendents, 2)
pendents <- data.frame(becat_nom = pendents, comarques_osm[5:6, ])

tesaurus_comarques <- rbind(tesaurus_comarques, pendents)
rownames(tesaurus_comarques) <- NULL

tesaurus_comarques[tesaurus_comarques$becat_nom == "Fenolhedés", ]
tesaurus_comarques[
tesaurus_comarques$becat_nom == "Fenolhedés", c("osm_name", "osm_type", "osm_id")
] <- c("Fenolledès", "relation", "16780160")

d_antic <- JoanBeCatNord.osm::tesaurus_comarques
sel_cols <- intersect(names(tesaurus_comarques), names(d_antic))
compareDF::view_html(compareDF::compare_df(tesaurus_comarques[, sel_cols], d_antic[, sel_cols]))

## Desa ----

usethis::use_data(tesaurus_comarques, overwrite = TRUE)
## Desa ----

# usethis::use_data(tesaurus_comarques, overwrite = TRUE)
load("data/tesaurus_comarques.rda", verbose = TRUE) # tesaurus_comarques

openxlsx::write.xlsx(
tesaurus_comarques,
file = "data-raw/tesaurus_comarques.xlsx", rowNames = FALSE, borders = "surrounding", colWidths = "auto",
firstRow = TRUE, headerStyle = openxlsx::createStyle(textDecoration = "BOLD")
)
readODS::write_ods(tesaurus_comarques, path = "data-raw/tesaurus_comarques.ods", row_names = FALSE)
Binary file modified data/tesaurus_comarques.rda
Binary file not shown.

0 comments on commit 32b5221

Please sign in to comment.