An R package to process text with the Receptiviti API.
Download R from r-project.org, then install the package from an R console:
Release (version 0.1.3)
install.packages("receptiviti")
Development (version 0.1.4)
# install.packages("remotes")
::install_github("Receptiviti/receptiviti-r") remotes
And load the package:
library(receptiviti)
# score a single text
<- receptiviti("a text to score")
single
# score multiple texts, and write results to a file
<- receptiviti(c("first text to score", "second text"), "filename.csv")
multi
# score texts in separate files
## defaults to look for .txt files
<- receptiviti("./path/to/txt_folder")
file_results
## could be .csv
<- receptiviti(
file_results "./path/to/csv_folder",
text_column = "text", file_type = "csv"
)
# score texts in a single file
<- receptiviti("./path/to/file.csv", text_column = "text") results
To access the API, you will need to load your key and secret, as found on your dashboard.
You can enter these as arguments in each function call, but by default they will be looked for in these environment variables:
RECEPTIVITI_KEY="32lettersandnumbers"
RECEPTIVITI_SECRET="56LettersAndNumbers"
You can store these in your R environment file permanently:
# opens ~/.Renviron; after editing, save and restart R
::edit_r_environ() usethis
Or set them temporarily:
Sys.setenv(
RECEPTIVITI_KEY = "32lettersandnumbers",
RECEPTIVITI_SECRET = "56LettersAndNumbers"
)