rename_fude() renames the elements of a Fude Polygon data object returned
by read_fude(). It replaces municipality codes in layer names with
municipality names and prefecture codes in MB0001 layer names with
prefecture names.
Arguments
- data
A Fude Polygon data object returned by
read_fude().- suffix
Logical. If
FALSE, municipality suffixes are removed from renamed element names. For example, romaji suffixes such as"-shi"and"-ku"are removed whenromajiis used.- romaji
Character scalar or
NULL. IfNULL, Japanese region names are used. Otherwise, region names are given in romaji. Supported values are"upper"for upper case,"title"for title case, and"lower"for lower case.- quiet
Logical. If
FALSE, print the mapping from old names to new names.
Details
Any year prefix in the original layer name is retained. Layer names without a recognized code or a name in the requested language are kept as supplied. If a new name would be duplicated, the region code is added to distinguish the renamed layers.
Examples
path <- system.file("extdata", "castle.zip", package = "fude")
d <- read_fude(path, quiet = FALSE)
#> Reading layer `2021_382019' from data source
#> `/private/var/folders/34/cc5j3spj0xs23b_r3j27pcr00000gn/T/RtmpYWmHYs/filebebb22df27c5/castle/2021_382019.json'
#> using driver `GeoJSON'
#> Simple feature collection with 1 feature and 7 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 132.7653 ymin: 33.84506 xmax: 132.7662 ymax: 33.84575
#> Geodetic CRS: WGS 84
#> Reading layer `2022_382019' from data source
#> `/private/var/folders/34/cc5j3spj0xs23b_r3j27pcr00000gn/T/RtmpYWmHYs/filebebb22df27c5/castle/2022_382019.json'
#> using driver `GeoJSON'
#> Simple feature collection with 1 feature and 7 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 132.7653 ymin: 33.84506 xmax: 132.7662 ymax: 33.84575
#> Geodetic CRS: WGS 84
#> Reading layer `2022_382078' from data source
#> `/private/var/folders/34/cc5j3spj0xs23b_r3j27pcr00000gn/T/RtmpYWmHYs/filebebb22df27c5/castle/2022_382078.json'
#> using driver `GeoJSON'
#> Simple feature collection with 1 feature and 7 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 132.541 ymin: 33.50931 xmax: 132.5415 ymax: 33.50966
#> Geodetic CRS: WGS 84
d2 <- rename_fude(d)
d2 <- rename_fude(d, suffix = FALSE)
d2 <- rename_fude(d, romaji = "upper")