knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
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.
You can install the development version of knackr from GitHub with:
# install.packages("devtools") devtools::install_github("MCodrescu/knackr")
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") )
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")
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.