FormShare is an advanced data management platform for Open Data Kit (ODK) . This R Package provides a simple connection object between FormShare and R for advanced analytics.
This class encapsulates all functions to execute analytics in FormShare directly from R.
user_id
The user ID in FormShare.
api_key
The API key used to connect to FormShare.
api_secret
The API secret used to connect to FormShare
server_url
The FormShare server to connect to
logged_in
Whether the used has a valid connection
api_token
Token to use in other functions
token_url
FormShare URL to retrieve a valid token
Create a new FormShare object.
= FormShare$new(
my_connection server_url = "https://formshare.org",
user_id = "your_user",
api_key = "your_api_key",
api_secret = "your_api_secret"
)
server_url
Server URL. By default https://formshare.org
user_id
The user ID to use
api_key
The API Key to use.
api_secret
The API Secret to use.
A connection object to FormShare.
Get the current API key.
= my_connection$get_api_key() current_api_key
Sets the current API key.
$set_api_key("new_api_key") my_connection
new_key
New API key
Get the current API secret
= my_connection$get_api_secret() current_api_secret
Sets the current API secret.
$set_api_secret("new_api_secret") my_connection
new_secret
New API secret
Get the current server URL
= my_connection$get_server_url() current_url
Sets the current server URL.
$set_server_url("new_url") my_connection
new_url
New server URL
Log-in to the FormShare server and stores a API token
$login() my_connection
True of False if the connection was successful.
Return the repositories that the user has access to.
= my_connection$get_repositories() my_repositories
A data frame with repositories that the user has access to.
Get the tables in a repository.
= my_connection$get_tables("repository_id") my_tables
repository
The repository to use
A data frame with tables inside a repository.
Get the fields in a table of a repository.
= my_connection$get_fields("repository_id", "table_name") my_fields
repository
The repository ID to use
table
The table to use
A data frame with fields inside a table.
Executes an SQL and returns it result.
= my_connection$execute("repository_id", "SELECT * FROM maintable") data
repository
The repository to use
sql
SQL to execute
A data frame with the result of the execution. Return TRUE if the result is empty or if the execution does not return any data. For example when executing a “CREATE VIEW”
A convenient function to return the contents of a table.
= my_connection$get_table("repository_id", "maintable") data
repository
The repository to use
table
Table to retrieve
A data frame with data of the table
The objects of this class are cloneable with this method.
= my_connection$clone(deep = FALSE) clone
deep
Whether to make a deep clone.