functions failing on first attempt with ! Must extract column with a single valid subscript
Closed this issue · 1 comments
Guessing this is something to do my personal setup but with a bunch of troubleshooting I can't seem to figure it out. See example below
coll <- "whse_basemapping.fwa_stream_networks_sp"
river <- fwapgr::fwa_query_collection(coll, filter = list(gnis_name = "Sangan River"))
on the first attempt this throws the error below. However, if I try again it works. Seems bizarre.
Error: ! Must extract column with a single valid subscript. x Subscript
attr(obj, "sf_column")has size 0 but must be size 1. Run
rlang::last_error()` to see where the error occurred.
rlang::last_error()
<error/vctrs_error_subscript_type>
Error:
! Must extract column with a single valid subscript.
x Subscriptattr(obj, "sf_column")
has size 0 but must be size 1.
Backtrace:
- fwapgr::fwa_query_collection(coll, filter = list(gnis_name = "Sangan River"))
- sf:::st_transform.sf(x, epsg)
- sf:::st_geometry.sf(x)
- tibble:::
[[.tbl_df
(obj, attr(obj, "sf_column")) - tibble:::tbl_subset2(x, j = i, j_arg = substitute(i))
- tibble:::vectbl_as_col_location2(j, length(x), names(x), j_arg = j_arg)
- vctrs::vec_as_location2(j, n, names)
- vctrs:::result_get(...)
Runrlang::last_trace()
to see the full context.
rlang::last_trace()
<error/vctrs_error_subscript_type>
Error:
! Must extract column with a single valid subscript.
x Subscriptattr(obj, "sf_column")
has size 0 but must be size 1.
Backtrace:
x
- -fwapgr::fwa_query_collection(coll, filter = list(gnis_name = "Sangan River"))
- +-sf::st_transform(x, epsg)
- -sf:::st_transform.sf(x, epsg)
-
+-sf::st_transform(st_geometry(x), crs, ...)
-
+-sf::st_geometry(x)
-
\-sf:::st_geometry.sf(x)
-
+-obj[[attr(obj, "sf_column")]]
-
\-tibble:::`[[.tbl_df`(obj, attr(obj, "sf_column"))
-
\-tibble:::tbl_subset2(x, j = i, j_arg = substitute(i))
-
\-tibble:::vectbl_as_col_location2(j, length(x), names(x), j_arg = j_arg)
-
+-tibble:::subclass_col_index_errors(...)
-
| \-base::withCallingHandlers(...)
-
\-vctrs::vec_as_location2(j, n, names)
-
\-vctrs:::result_get(...)
-
\-rlang::cnd_signal(x$err)`
sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252 LC_NUMERIC=C
[5] LC_TIME=English_Canada.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8 rstudioapi_0.13 fwapgr_0.1.0.9011 magrittr_2.0.2 units_0.8-0
[6] tidyselect_1.1.1 R6_2.5.1 rlang_1.0.1 fansi_1.0.2 httr_1.4.2
[11] dplyr_1.0.6 tools_4.0.5 grid_4.0.5 utf8_1.2.2 KernSmooth_2.23-18
[16] cli_3.2.0 e1071_1.7-9 DBI_1.1.2 ellipsis_0.3.2 class_7.3-18
[21] assertthat_0.2.1 tibble_3.1.6 lifecycle_1.0.1 crayon_1.5.0 pgfeatureserv_0.0.0.9001
[26] sf_1.0-6 purrr_0.3.4 vctrs_0.3.8 curl_4.3 glue_1.6.2
[31] geojsonsf_2.0.1 proxy_0.4-26 compiler_4.0.5 pillar_1.7.0 chk_0.8.0.9000
[36] generics_0.1.2 classInt_0.4-3 pkgconfig_2.0.3
Works fine on my machine but I'm on R 4.1.2 - I'd try updating everything