Skip to content

arc_select() throwing Error in x[[1]] : subscript out of bounds #283

@t-stratmann

Description

@t-stratmann

Hi Josiah,

Thank-you first of all for your amazing package. It is opening new automation possibilities for us and allowing for better data management. I am just having some issues with the arc_select() function. I have skimmed stack overflow and issue reports for your packages but have not gotten wiser.

For me the arc_select() function only works if I run it 2-3 times. The first time it fails and gives me Error in x[[1]] : subscript out of bounds. Then on the 2nd or 3rd attempt it works. This wouldn't be a huge issue but I need this to work in an Rmarkdown file and so this of course stops the document from knitting. Here is the output in my console with sessionInfo() included:

library(arcgis)
Attaching core arcgis packages:
→ arcgisutils v0.4.0
→ arcgislayers v0.5.2
→ arcgisgeocode v0.4.0
→ arcgisplaces v0.1.2
→ arcpbf v0.2.0

sessionInfo()
R version 4.5.1 (2025-06-13 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)

Matrix products: default
LAPACK version 3.12.1

locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8

time zone: Europe/Berlin
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] arcpbf_0.2.0 arcgisplaces_0.1.2 arcgisgeocode_0.4.0 arcgislayers_0.5.2 arcgisutils_0.4.0 arcgis_0.2.0

loaded via a namespace (and not attached):
[1] digest_0.6.37 R6_2.6.1 fastmap_1.2.0 xfun_0.53 knitr_1.50 htmltools_0.5.8.1 rmarkdown_2.30
[8] lifecycle_1.0.4 cli_3.6.5 S7_0.2.0 compiler_4.5.1 rstudioapi_0.17.1 tools_4.5.1 evaluate_1.0.5
[15] yaml_2.3.10 rlang_1.1.6

key <- auth_key()
set_arc_token(key)

fences.url <- "https://services5.arcgis.com/Z0KEnSw0ZS6aB5oA/arcgis/rest/services/IH_RE_Fences_lines_active/FeatureServer/0"
fences.layer <- arc_open(fences.url)
fences.shp <- arc_select(fences.layer)
Error in x[[1]] : subscript out of bounds

fences.shp <- arc_select(fences.layer)
plot(fences.shp["NAME"], pch = 16, cex = 0.5)

RE.landscapes.url <- "https://services5.arcgis.com/Z0KEnSw0ZS6aB5oA/arcgis/rest/services/Areas_Current_and_Active_RA_PA_and_PS/FeatureServer/0"
RE.landscapes.layer <- arc_open(RE.landscapes.url)
RE.landscapes.all <- arc_select(RE.landscapes.layer)
Error in x[[1]] : subscript out of bounds

RE.landscapes.all <- arc_select(RE.landscapes.layer)

You can see with both files, it loaded on the second time. Any insight you can offer would be much appreciated!

Theresa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions