Closed
Description
Hi.
There is an error when plotting a map of a sf
object if the decimal separator is set to the comma in R options.
library(tidyverse)
library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf"))
# works fine
ggplot() +
geom_sf(data = nc)
# raises an error
options(OutDec = ",")
ggplot() +
geom_sf(data = nc)
#>Error in parse(text = text[[i]]) : <text>:1:3: unexpected ','
#>1: 34,
^
traceback
traceback()
#>15: parse(text = text[[i]])
#>14: parse_safe(graticule$degree_label[needs_parsing])
#>13: f(..., self = self)
#>12: self$fixup_graticule_labels(graticule, scale_x, scale_y, params)
#>11: f(..., self = self)
#>10: self$coord$setup_panel_params(scale_x, scale_y, params = self$coord_params)
#>9: (function (scale_x, scale_y)
#> {
#> self$coord$setup_panel_params(scale_x, scale_y, params = self$coord_params)
#> })(dots[[1L]][[1L]], dots[[2L]][[1L]])
#>8: mapply(FUN = f, ..., SIMPLIFY = FALSE)
#>7: Map(setup_panel_params, scales_x, scales_y)
#>6: f(..., self = self)
#>5: layout$setup_panel_params()
#>4: ggplot_build.ggplot(x)
#>3: ggplot_build(x)
#>2: print.ggplot(x)
#>1: (function (x, ...)
#> UseMethod("print"))(x)
As a workaround we can revert to the dot decimal separator before the plot...