I have a large number of file geodatabase tables that I'd like to load directly into R as data frames. I have upwards of 80 - 100 tables and it would be much more convenient to automate this process.

I've been playing around with the arcgisbinding package in R, specifically the arc.open() and arc.select() functions, and although loading single tables at a time is easy, I'm struggling to write a script that will execute this process for multiple tables at once. Here's my script so far:


# Assign my fgdb to a variable and create a character vector of the fgdb table names.
fgdb <- "D:/WorkingDirectory/ZStatTables.gdb"
TableList <- arc.open(fgdb)@children$Table 

Following code I found here, I tried to loop through the vector of FGDB table names to load each table into R.

a <- NULL
for(i in 1:length(TableList)){
  a[[i]] <- arc.select(arc.open(paste(gdb,"/",TableList[i], sep = "")))

This produces a list of all of the tables, but their names have not been assigned to them. Is there a way to assign each table it's correct name? Or an altogether better way to load a lot of FGDB tables into R?

Any ideas, either using the arcgisbinding package or other methods?

  • Where are the names stored? In another element of the opened fgdb? Or are they the names of TableList such htat names(TableList) shows them? In which case names(a) <- names(TableList) should do the trick.
    – Spacedman
    Commented May 29, 2020 at 21:59
  • See ?sf::read_sf - the fgdb folder is the dsn, the table is the layer, you can get the layers with st_layers, and so loop or lapply read_sf() over sf::st_layers(fgdb)$name
    – mdsumner
    Commented May 31, 2020 at 5:19
  • Thanks @Spacedman for your comment. When I try your suggestion, 'names(TableList)', the output is 'NULL'. 'TableList' is a character object that contains all of the table names as strings. Is there a way to assign these strings to their corresponding table like you suggested? Commented Jun 1, 2020 at 15:37
  • names(a) <- TableList should work.
    – Spacedman
    Commented Jun 1, 2020 at 15:39
  • Yes perfect, so simple. Thank you @Spacedman. Commented Jun 1, 2020 at 15:48

1 Answer 1


Assuming the $Table element of the children is a vector of the names:

TableList <- arc.open(fgdb)@children$Table

so that it prints something like this:

> TableList
[1] "first"     "second"    "third-000"

then you can probably loop over these names and create the named list directly:

a <- NULL
for(T_name in TableList){
   a[[T_name]] <- arc.select(
             paste(gdb,"/",T_name, sep = "")

If that doesn't work then your original code followed by:

 names(a) <- TableList


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.