tibble must be vectors

Trying to plot sf map. Class [ "sf" "data.frame"] I get the "All columns in a tibble must be vectors" error. One of the columns sfc_MULTIPOLYGON object. REPREX/Version are below.

#reprex

nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
ggplot(nc) + geom_sf(aes(fill = AREA))

Generate the following error

Error: All columns in a tibble must be vectors.
✖ Column `geometry` is a `sfc_MULTIPOLYGON/sfc` object.

SF and ggplot2 versions

packageDescription("ggplot2")
Package: ggplot2
Version: 3.3.0

packageDescription("sf")
Package: sf
Version: 0.9-4

it works for me and I have those same two package versions as you.
What's your tibble version ?

packageVersion("tibble")
[1] ‘3.0.1’
sessionInfo()
-------------
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

That was it! Upgrade 'vctrs' to vctrs_0.3.1. fixed the problem. The error message threw me off. There might come lots of unwarranted blame on "sf" because of this. Might be good idea to add in the error message to check the vctr version.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

My package version is ‘3.0.1’ what version of "R" are you on?

This sounds like a vctrs issue to me. You might try updating to the most recent version that package. I can't reproduce the error with the following package version on my system:

packageVersion("vctrs")
[1] ‘0.3.1’
packageVersion("sf")
[1] ‘0.9.4’
packageVersion("tibble")
[1] ‘3.0.1’

Possibly. Is the 'vctrs' version you have on CRAN?

Yes, 0.3.1 is the most recent CRAN version

https://cran.r-project.org/web/packages/vctrs/index.html