I am trying to replicate the analysis in here. When I am trying to plot the first map with geom_sf I get the following error: Error: 'st_normalize' is not an exported object from 'namespace:sf'. The data I am using to plot (england_ext) is a sfobject
Simple feature collection with 1630 features and 14 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: 87143.77 ymin: 7126.157 xmax: 655477.1 ymax: 657545
epsg (SRID): NA
proj4string: +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +datum=OSGB36 +units=m +no_defs
# A tibble: 1,630 x 15
objectid lad17cd lad17nm lad17nmw bng_e bng_n long lat st_areasha
<dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 E06000… Hartle… NA 447157 531476 -1.27 54.7 96586817.
2 1 E06000… Hartle… NA 447157 531476 -1.27 54.7 96586817.
3 1 E06000… Hartle… NA 447157 531476 -1.27 54.7 96586817.
4 1 E06000… Hartle… NA 447157 531476 -1.27 54.7 96586817.
5 1 E06000… Hartle… NA 447157 531476 -1.27 54.7 96586817.
6 2 E06000… Middle… NA 451141 516887 -1.21 54.5 54741668.
7 2 E06000… Middle… NA 451141 516887 -1.21 54.5 54741668.
8 2 E06000… Middle… NA 451141 516887 -1.21 54.5 54741668.
9 2 E06000… Middle… NA 451141 516887 -1.21 54.5 54741668.
10 2 E06000… Middle… NA 451141 516887 -1.21 54.5 54741668.
# … with 1,620 more rows, and 6 more variables: st_lengths <dbl>, year <chr>,
# dependency <dbl>, quintile_dep <fct>, lab_dep <ord>, geometry <MULTIPOLYGON
# [m]>
And the code I am using is:
england_ext %>%
filter(year == "2016") %>%
mutate(lab_dep = gsub("[[:alpha:]]", "", lab_dep)) %>%
rename(OADR = quintile_dep) %>%
ggplot(aes(x = long, y = lat, fill = OADR)) +
geom_sf(colour = alpha("grey", 1 /3), size = 0.2)
Error: 'st_normalize' is not an exported object from 'namespace:sf'
With the information you provide, we cannot reproduce your problem. Have you tried updating sf?
Yes. That was the problem - older version of sf. Many thanks and apologies for the inconvenience.
Most helpful comment
Yes. That was the problem - older version of
sf. Many thanks and apologies for the inconvenience.