R wrapper for the Ready Signal API: http://app.readysignal.com
Please direct all questions and/or recommendations to support@readysignal.com
# install from CRAN
install.packages("readysignal")
# or install from GitHub
library(devtools)
::install_github("rxa-io/readysignal-r") devtools
Your access token and signal ID can be found on your “Manage Signal” page within the Output information
The signal ID is also visible within the URL of the “Manage Signal” page:
https://app.readysignal.com/signal/SIGNAL_ID/manage
library(readysignal)
<- "YOUR_ACCESS_TOKEN"
access_token <- 123 # your signal ID here signal_id
Use the help()
function in the R shell for details
# view all functions...
help(package = readysignal)
# ...or view a single help page
help(signal_to_csv)
library(readysignal)
# using an environment variable is optional but useful
<- Sys.getenv("MY_TOKEN")
token
# grab list of signals
<- list_signals(token)
signals
# find a signal ID
<- signals$id[1]
signal_id
# grab the signal details
<- get_signal_details(token, signal_id)
details print(details$name)
# grab the signal data as a dataframe...
<- get_signal(token, signal_id)
signal_df print(dim(signal_df))
# ...or save it directly as a CSV
signal_to_csv(token, signal_id, 'my_signal.csv')
# create a new signal with the AutoDiscovery feature
# from a dataframe. When geo-grain=Country, columns
# MUST be c("Date", "Value"). When geo-grain=State,
# columns MUST be c("Date", "Value", "State")
<- data.frame(
df Date=c("2022-01-01", "2022-01-02", "2022-01-03"),
Value=c(351, 465, 712)
)auto_discover(token, geo_grain="Country", date_grain="Day", df=df)
# use AutoDiscovery with a file upload, this time we'll
# use a State geo_grain. The file needs the same columns
# as described above
system("cat states.csv") # Date,State,Value
# 2020-03-01,TN,416000
# 2020-03-01,KY,373000
# ...
<- auto_discover(token, geo_grain="State", date_grain="Month", filename="states.csv")
resp
# delete a signal (in this case, the one we just created)
delete_signal(token, resp$signal_id)