MyNixOS website logo
Description

Efficient Wrapper for the 'Airtable' API.

Efficient CRUD interface for the 'Airtable' API <https://airtable.com/developers/web/api>, supporting batch requests and parallel encoding of large data sets.

rairtable

Efficient CRUD interface to the Airtable API

R-CMD-check CRAN_Status_Badge metacrandownloads

rairtable is an efficient, Tidyverse-friendly interface to the Airtable API intended to simplify the integration of Airtable into data science workflows. Other R packages exist for this purpose, but rairtable offers the following advantages:

  • Create, update, and delete Airtable records in batches of up to 10 at a time
  • Optional parallelization of JSON encoding for large tables
  • Tidyverse conscious development, facilitating Airtable as an endpoint for dplyr pipelines
  • Support for Airtable views
  • Convenient interface for setting and updating Airtable API keys

INSTALLATION

For the stable CRAN release, install using install.packages('rairtable'). For the development version of the package, use remotes::install_giuthub('matthewjrogers/rairtable', ref = 'dev)


USAGE

Get and set your API key

Generate an Airtable API key from your Airtable account page and pass the result to set_airtable_api_key('MY_KEY_HERE'). If you would like to store the key in your .Renviron file for use in the future, use set_airtable_api_key('MY_KEY_HERE', install = TRUE). This will also work work with Personal Access Tokens

Connect to a table

table <- airtable('TABLE_NAME', 'BASE_ID')

view <- airtable('TABLE_NAME', 'BASE_ID', view = 'VIEW_NAME')

rairtable::airtable() creates an airtable object that is used in a similar fashion to a database connection. The resulting object is then passed to other rairtable functions.

Read a table

airtable_data <- read_airtable(airtable_object, id_to_col = TRUE, max_rows = 50000)

By default, read_airtable() will read all rows in the chosen table and store Airtable records IDs in a column named airtable_record_id. Optionally, airtable record IDs can be stored as row names for convenience.

Row names are bad practice in most cases. For this application, they offer the advantage of being sticky through most subset and transform operations which allows us to retain the record ID by default. Some operations will destroy row names (e.g. the use of dplyr::arrange()). For these reasons, the default behavior is to store the record IDs in a column. Airtable record IDs are necessary for update and delete operations, but otherwise can be ignored.

Workflow

rairtable is intended to slot into existing data processing workflows.

table <- airtable('mtcars', 'appXXXXXXXXXXXXXX')

cars_airtable <- read_airtable(table)

# change units of qsec to minutes
cars_airtable <- cars_airtable %>%
  mutate(qsec = qsec/60) %>%
  update_records(table, columns = qsec)

# remove records where mpg is less than 12
removed_ids <- cars_airtable %>%
  filter(mpg < 12) %>%
  delete_records(table)

cars_airtable %>%
  filter(!airtable_record_id %in% removed_ids)


Metadata

Version

0.1.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows