Closed jamesha95 closed 4 years ago
hmm can't reproduce that error after updating tidyverse
:
library(tidyverse)
library(absmapsdata)
library(sf)
#> Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0
tribble(~x, ~y,
"Melbourne", 1,
"Docklands", 5) %>%
left_join(sa22016, by = c('x' = 'sa2_name_2016'))
#> # A tibble: 2 x 16
#> x y sa2_main_2016 sa2_5dig_2016 sa3_code_2016 sa3_name_2016
#> * <chr> <dbl> <chr> <chr> <chr> <chr>
#> 1 Melb… 1 206041122 21122 20604 Melbourne Ci…
#> 2 Dock… 5 206041118 21118 20604 Melbourne Ci…
#> # … with 10 more variables: sa4_code_2016 <chr>, sa4_name_2016 <chr>,
#> # gcc_code_2016 <chr>, gcc_name_2016 <chr>, state_code_2016 <chr>,
#> # state_name_2016 <chr>, areasqkm_2016 <dbl>, cent_long <dbl>,
#> # cent_lat <dbl>, geometry <MULTIPOLYGON [°]>
Created on 2020-04-23 by the reprex package (v0.3.0)
@jamesha95 it might be that you did it without loading sf? There's a vec_proxy thing in sf that makes tibble see the geometry column as an actual list, i.e. class == c("sfc_MULTIPOLYGON", "sfc", "list")
and the new tibble requires that. (just so you know, it seemed pretty obscure to me before I knew)
Ah yep, that solved it. Many thanks!
After updating tidyverse, it seems that sfc objects can no longer by
left_join
'd to tibbles, only data.frames.leads to
Error: Input must be a vector, not a sfc_MULTIPOLYGON/sfc object.
But
seems to work.