knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

knackr

R-CMD-check

The goal of knackr is to facilitate interaction with Knack Databases using the Knack API. If you have any questions or issues please submit a GitHub issue or contact me at m.codrescu@outlook.com.

Installation

You can install the development version of knackr from GitHub with:

# install.packages("devtools")
devtools::install_github("MCodrescu/knackr")

Set Credentials

Before interacting with the database, set your API credentials in the R session.

knackr::set_credentials(
  api_id = keyring::key_get("Knack Trial", "api_id"),
  api_key = keyring::key_get("Knack Trial", "api_key")
)

List Objects

You can list the objects present in a database by using the list_objects() function.

``` {r list-objects} knackr::list_objects()

## List Fields

You can also list the fields present in an object using `list_fields()`.

``` {r list-fields}
knackr::list_fields("mtcars")

Retrieve Records

You can retrieve records from a table using retrieve_records().

result <- knackr::retrieve_records("mtcars")

dplyr::glimpse(result)

By default, retrieve_records() returns the entire object, but you can specify the number of rows retrieved.

result <- knackr::retrieve_records("mtcars", n = 5)

dplyr::glimpse(result)

If you are not sure how many records you have in a table you can use n_records() to determine it.

knackr::n_records("mtcars")


MCodrescu/knackr documentation built on July 2, 2023, 11:49 a.m.