Skip to content
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

Open
DrewryWang opened this issue May 11, 2024 · 3 comments
Open

Error in `vec_rbind() #1934

DrewryWang opened this issue May 11, 2024 · 3 comments
Labels
reprex needs a minimal reproducible example

Comments

@DrewryWang
Copy link

! 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:

  1. ├─sfnetworks::to_spatial_smooth(net)
  2. │ └─sfnetworks:::bind_rows_list(edges, new_edges)
  3. │ └─dplyr::bind_rows(ins)
  4. │ └─vctrs::vec_rbind(!!!dots, .names_to = .id, .error_call = current_env())
  5. └─rlang:::stop_internal_c_lib(...)
  6. └─rlang::abort(message, call = call, .internal = TRUE, .frame = frame)
@DrewryWang
Copy link
Author

After I created a sfnetwork object from linestrings, I was trying to smooth the network by removing pseudo nodes.
Here are my code:
Link_Output_sf <- Link_to_Linestring(Link_Output[1:10000,])
net <- sfnetworks::as_sfnetwork(Link_Output_sf)
smoothed_net = to_spatial_smooth(net)

you can find more info about sfnetworks and removing pseudo nodes at the link:
https://luukvdmeer.github.io/sfnetworks/articles/sfn02_preprocess_clean.html

@DavisVaughan
Copy link
Member

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 DavisVaughan added the reprex needs a minimal reproducible example label May 14, 2024
@DrewryWang
Copy link
Author

@DavisVaughan Sorry that I couldn't turn it into a reprex as the code needs to read a external shp file.
However, I am attaching the minimal code and the file necessary as below. Hopefully you can run it on your side.

##Code
library(sfnetworks)
library(sf)
Link_Output_sf <- read_sf('~/link_output.shp') # Replace the shp file within the attached folder after unzip
net <- sfnetworks::as_sfnetwork(Link_Output_sf)
smoothed_net = to_spatial_smooth(net)
##End of Code

link_output_shp.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

2 participants