Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MCodrescu/knackr
R Package for Connecting to Knack Databases
https://github.com/MCodrescu/knackr
knack r
Last synced: 3 months ago
JSON representation
R Package for Connecting to Knack Databases
- Host: GitHub
- URL: https://github.com/MCodrescu/knackr
- Owner: MCodrescu
- License: other
- Created: 2021-12-17T19:09:39.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-19T01:18:57.000Z (over 1 year ago)
- Last Synced: 2024-06-05T00:40:04.648Z (5 months ago)
- Topics: knack, r
- Language: R
- Homepage:
- Size: 88.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - MCodrescu/knackr - R Package for Connecting to Knack Databases (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# knackr
[![R-CMD-check](https://github.com/MCodrescu/knackr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/MCodrescu/knackr/actions/workflows/R-CMD-check.yaml)
The goal of knackr is to facilitate interaction with Knack Databases using the [Knack](https://www.knack.com/) API. If you have any questions or issues please submit a GitHub issue or contact me at [email protected].
## Installation
You can install the development version of knackr from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("MCodrescu/knackr")
```## Set Credentials
Before interacting with the database, set your API credentials in the R session.
```{r example}
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()`.```{r retrieve-all}
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.
```{r}
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.
```{r}
knackr::n_records("mtcars")
```