-
Notifications
You must be signed in to change notification settings - Fork 66
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
Error in vec_rbind()
#1934
Comments
After I created a sfnetwork object from linestrings, I was trying to smooth the network by removing pseudo nodes. you can find more info about sfnetworks and removing pseudo nodes at the link: |
Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff. If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. You can install reprex by running (you may already have it, though, if you have the tidyverse package installed): install.packages("reprex") Thanks |
@DavisVaughan Sorry that I couldn't turn it into a reprex as the code needs to read a external shp file. ##Code |
@DrewryWang have you managed to work around this somehow? |
Ran into this same error. problem arises when there is an library(dplyr);library(sf)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#> Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
bind_rows(list(db1 = data.frame(), db2=data.frame(x=84, y=32)%>%st_as_sf(coords=c("x","y"))))
#> Error in `vec_rbind()`:
#> ! `c()` method returned a vector of unexpected size 3 instead of 1.
#> ℹ In file 'c.c' at line 412.
#> ℹ This is an internal error that was detected in the vctrs package.
#> Please report it at <https://github.com/r-lib/vctrs/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace. Created on 2024-09-09 with reprex v2.1.1 |
I came into same issue when list contains empty empty with zero rows. One fix is to filter out empty dataframes before calling bind_rows. |
I run into this issue also. A very simple reprex: library(sf)
#> Linking to GEOS 3.12.2, GDAL 3.9.2, PROJ 9.5.0; sf_use_s2() is TRUE
library(dplyr)
#>
#> Adjuntando el paquete: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
g <- sf::st_sfc(st_point(1:2))
foo <- sf::st_sf(a = 3, g) |>
dplyr::as_tibble()
bar <- dplyr::tibble()
dplyr::bind_rows(foo, bar)
#> Error in `vec_rbind()`:
#> ! `c()` method returned a vector of unexpected size 3 instead of 1.
#> ℹ In file 'c.c' at line 412.
#> ℹ This is an internal error that was detected in the vctrs package.
#> Please report it at <https://github.com/r-lib/vctrs/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace. Created on 2024-10-29 with reprex v2.1.0 If I remove the geometry column or transform it to any other class, it works. |
!
c()
method returned a vector of unexpected size 10002 instead of 10000.ℹ In file c.c at line 414.
ℹ Install the winch package to get additional debugging info the next time you get this error.
ℹ This is an internal error that was detected in the vctrs package.
Please report it at https://github.com/r-lib/vctrs/issues with a reprex (https://tidyverse.org/help/) and the full backtrace.
Backtrace:
▆
The text was updated successfully, but these errors were encountered: