-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
purrr::list_cbind()
and vctrs::vec_cbind()
returning a data.frame instead of a sf object
#2157
Comments
Hi @elipousson I have just seen this. I already raised a similar issue (though relating to list_rbind()) on the purrr repo. (Though a few days after you raised this issue!) |
It wouldn't be a big issue but Here is an example showind the issue with nc <- sf::read_sf(system.file("shape/nc.shp", package = "sf"))
nc_bind_rows <- dplyr::bind_rows(
nc[2, ],
nc[1, ]
)
class(nc_bind_rows)
#> [1] "sf" "tbl_df" "tbl" "data.frame"
nc_vec_rbind <- vctrs::vec_rbind(
nc[2, ],
nc[1, ]
)
class(nc_vec_rbind)
#> [1] "data.frame"
class(sf::st_as_sf(nc_vec_rbind))
#> [1] "sf" "data.frame" Created on 2023-06-26 with reprex v2.0.2 |
I do think this is an issue with vctrs or purrr not with sf though. |
To be clear, |
Thanks for that reminder! |
Combining a simple feature object with a data.frame using
purrr::list_cbind()
orvctrs::vec_cbind()
returns a data.frame instead of an sf object as expected.Created on 2023-04-29 with reprex v2.0.2
I'm pretty sure that both approaches worked with sf objects previously so I'm unsure if there was a change in vctrs or a change in sf.
The text was updated successfully, but these errors were encountered: