| Title: | Access your Coletum's Data from API |
|---|---|
| Description: | Get your data (forms, structures, answers) from Coletum <https://coletum.com> to handle and analyse. |
| Authors: | André Smaniotto [aut, cre], Marcelo Magnani [aut], Rodrigo Sant'Ana [aut], GeoSapiens [cph, fnd] |
| Maintainer: | André Smaniotto <[email protected]> |
| License: | LGPL-3 |
| Version: | 1.0.0.9000 |
| Built: | 2026-05-30 09:32:12 UTC |
| Source: | https://github.com/geo-sapiens/rcoletum |
An R package to get data from Coletum.
The currents functions that are provide by RColetum are:
GetForms: get the information about all forms.
GetForm: get the metadata and field structure of a form.
GetAnswers: get the all the answers of a form or
personalize with filters and take just what you need.
FlattenAnswers: flatten a GetAnswers result into
a single data frame.
Maintainer: André Smaniotto [email protected]
Authors:
Marcelo Magnani [email protected]
Rodrigo Sant'Ana [email protected]
Other contributors:
GeoSapiens [copyright holder, funder]
Useful links:
Report bugs at https://github.com/geo-sapiens/RColetum/issues
Converts the output of GetAnswers into a single flat
data.frame. Works with any form: if the form is simple (no groups or
multivalued fields), GetAnswers already returns a plain
data.frame and this function returns it unchanged. For forms with
groups or multivalued fields, the main data frame and all nested data frames
are joined using dplyr::full_join.
FlattenAnswers(answers)FlattenAnswers(answers)
answers |
The return value of |
When the form contains multivalued groups or fields, each submission may produce multiple rows in the nested data frames. Joining them to the main data frame causes row duplication: each combination of main row and nested row is represented. Account for this in any aggregation.
A single data.frame. For simple forms the columns keep their
original names. For forms with groups, main-frame columns are prefixed
with "answer." and nested-frame columns are prefixed with their
group componentId.
answers <- GetAnswers("cizio7xeohwgc8k4g4koo008kkoocwg", 5719) FlattenAnswers(answers) # Pipe-friendly GetAnswers("cizio7xeohwgc8k4g4koo008kkoocwg", 5719) |> FlattenAnswers()answers <- GetAnswers("cizio7xeohwgc8k4g4koo008kkoocwg", 5719) FlattenAnswers(answers) # Pipe-friendly GetAnswers("cizio7xeohwgc8k4g4koo008kkoocwg", 5719) |> FlattenAnswers()
Get all the current answers of a specific form. This function calls
GetForm internally to understand the form structure.
GetAnswers( token, idForm, nameForm = NULL, source = NULL, createdAfter = NULL, createdBefore = NULL, updatedAfter = NULL, updatedBefore = NULL, createdBy = NULL, updatedBy = NULL, page = 1, page_size = 100, all_pages = TRUE )GetAnswers( token, idForm, nameForm = NULL, source = NULL, createdAfter = NULL, createdBefore = NULL, updatedAfter = NULL, updatedBefore = NULL, createdBy = NULL, updatedBy = NULL, page = 1, page_size = 100, all_pages = TRUE )
token |
String access token. |
idForm |
Numeric Id of the required form. |
nameForm |
String name of the required form. Used only when idForm is not supplied. When this parameter is used, one extra access quota is spent. |
source |
Optional filter. Origin of the answer: |
createdAfter |
Optional filter. Returns answers created after this date
(exclusive). Accepts ISO 8601 format ( |
createdBefore |
Optional filter. Returns answers created before this date (exclusive). Accepts ISO 8601 format. |
updatedAfter |
Optional filter. Returns answers updated after this date (exclusive). Accepts ISO 8601 format. |
updatedBefore |
Optional filter. Returns answers updated before this date (exclusive). Accepts ISO 8601 format. |
createdBy |
Optional filter. Returns answers created by the user with this numeric ID. |
updatedBy |
Optional filter. Returns answers whose last update was made by the user with this numeric ID. |
page |
Integer. Starting page when |
page_size |
Integer. Number of records per API request (max 500). Default: 100. |
all_pages |
Logical. If |
To get more details about the fields provided by the result, please visit the API documentation.
A list with two elements when the form has groups or multivalued
fields: the first element is the main data frame (scalar fields and
metadata), the second is a named list of nested data frames linked by
main_df_id. For simple forms with no groups or multivalued fields, a
single data.frame is returned directly. Use FlattenAnswers
to join everything into one flat table.
Metadata columns in the main data frame:
main_df_id, created_by_user_name, created_by_user_id,
created_at_source, created_at,
created_at_coordinates.latitude,
created_at_coordinates.longitude, updated_at,
updated_at_coordinates.latitude,
updated_at_coordinates.longitude.
GetAnswers("cizio7xeohwgc8k4g4koo008kkoocwg", 5705) GetAnswers(token = "cizio7xeohwgc8k4g4koo008kkoocwg", nameForm = "RColetum Test - Iris") GetAnswers(token = "cizio7xeohwgc8k4g4koo008kkoocwg", idForm = 5705, createdAfter = "2012-12-20", createdBefore = "2018-12-20") GetAnswers(token = "cizio7xeohwgc8k4g4koo008kkoocwg", idForm = 5705, source = "web_public", createdAfter = "2012-12-20T19:20:30+01:00", createdBefore = "2018-12-20T19:20:30+01:00") GetAnswers(token = "cizio7xeohwgc8k4g4koo008kkoocwg", idForm = 5705, all_pages = FALSE, page = 1, page_size = 3)GetAnswers("cizio7xeohwgc8k4g4koo008kkoocwg", 5705) GetAnswers(token = "cizio7xeohwgc8k4g4koo008kkoocwg", nameForm = "RColetum Test - Iris") GetAnswers(token = "cizio7xeohwgc8k4g4koo008kkoocwg", idForm = 5705, createdAfter = "2012-12-20", createdBefore = "2018-12-20") GetAnswers(token = "cizio7xeohwgc8k4g4koo008kkoocwg", idForm = 5705, source = "web_public", createdAfter = "2012-12-20T19:20:30+01:00", createdBefore = "2018-12-20T19:20:30+01:00") GetAnswers(token = "cizio7xeohwgc8k4g4koo008kkoocwg", idForm = 5705, all_pages = FALSE, page = 1, page_size = 3)
Retrieves the metadata and complete component (field) structure of a
specific form. This function replaces the former GetFormStructure.
GetForm(token, idForm, nameForm = NULL)GetForm(token, idForm, nameForm = NULL)
token |
A string access token. |
idForm |
Numeric Id of the required form. |
nameForm |
String name of the required form. Used only when
|
To get more details about the fields provided by the result, please visit the API documentation.
A list with elements: id, name, description,
status, category, version, public_answers,
and components (a nested data frame representing the form's field
schema, where each row is a component with columns id,
type, label, help_block, maximum,
minimum, visibility, and — for group components —
components).
GetForm("cizio7xeohwgc8k4g4koo008kkoocwg", 5705) GetForm("cizio7xeohwgc8k4g4koo008kkoocwg", nameForm = "RColetum Test - Iris") GetForm(token = "cizio7xeohwgc8k4g4koo008kkoocwg", nameForm = "RColetum Test - Iris")GetForm("cizio7xeohwgc8k4g4koo008kkoocwg", 5705) GetForm("cizio7xeohwgc8k4g4koo008kkoocwg", nameForm = "RColetum Test - Iris") GetForm(token = "cizio7xeohwgc8k4g4koo008kkoocwg", nameForm = "RColetum Test - Iris")
Retrieve information about all forms in the account.
GetForms( token, status = NULL, name = NULL, page = 1, page_size = 100, all_pages = TRUE )GetForms( token, status = NULL, name = NULL, page = 1, page_size = 100, all_pages = TRUE )
token |
String access token. |
status |
Optional filter. State of the form: |
name |
Optional filter. Returns forms whose name contains this string (partial match, case-insensitive). |
page |
Integer. Starting page when |
page_size |
Integer. Number of records per API request (max 500). Default: 100. |
all_pages |
Logical. If |
To get more details about the fields provided by the result, please visit the API documentation.
A data frame with columns: id, name,
description, status, category, version,
public_answers. Returns NULL with a warning if no forms are
found.
GetForms("cizio7xeohwgc8k4g4koo008kkoocwg") GetForms("cizio7xeohwgc8k4g4koo008kkoocwg", status = "enabled") GetForms("cizio7xeohwgc8k4g4koo008kkoocwg", name = "Iris") GetForms("cizio7xeohwgc8k4g4koo008kkoocwg", page_size = 3, all_pages = FALSE)GetForms("cizio7xeohwgc8k4g4koo008kkoocwg") GetForms("cizio7xeohwgc8k4g4koo008kkoocwg", status = "enabled") GetForms("cizio7xeohwgc8k4g4koo008kkoocwg", name = "Iris") GetForms("cizio7xeohwgc8k4g4koo008kkoocwg", page_size = 3, all_pages = FALSE)