This package was created to make the KOA database by Baskaran et al. 2021 easily accessible and searchable. The data is stored as a SQL database however the functions in this package allows users to extract data using R.

There are three main types of functions included. Get functions provide a list of variables that users may find helpful in running queries. Table functions which pulls all data from a specific table within the database. Query functions search and summarize data from the entire database.

#devtools::install_github("sivanibaskaran/koadata")
library(koadata) 

Read about the different types of functions here: * vignette("Get") * vignette("Table") * vignette("Quercy")

In all functions, the version of the database can also be specified. By default, they all use the latest version (and currently only version) of the database. If there are multiple versions of the database, they can be called and specified using the ver argument

Access the SQL Database Directly

For users who wish to access the SQL version of the database directly and perform custom queries the koa.database() function creates a connection to the database file. If used, the other functions within the package will not work correctly until the database is disconnected using DBI::dbDisconnect().

# conn <- koa.database()
# DBI::dbDisconnect(conn)

For more information on using SQL within R see DBI and RSQLite or other similar packages.