Interface to 'typeform' Results

An R interface to the 'typeform' < https://typeform.com> application program interface. Also provides functions for downloading your results.


Build Status Downloads CRAN_Status_Badge codecov.io

Typeform is a company that specialises in online form building. This R package allows users to download their form results through the exposed API.

Installation

The package can be installed from CRAN

install.packages("rtypeform")

The package can then be loaded in the usual way

library("rtypeform")

Using the package

To use this package, you will need a data API key. With this key in position, you can then list your available forms

api = "XXXXX"
typeforms = get_typeforms(api)
typeforms$content

If you don't pass your api key as an argument, it will attempt to read the variable typeform_api from your .Renviron file, via Sys.getenv("typeform_api"). If this variable is set correctly, then you can omit the api argument

typeforms = get_typeforms()

In all function calls below, the api argument can be ommitted if the environment variable is set (see Efficient R programming Chapter 2 for more details).

You can download data from a particular typeform via

uid = typeforms$content$uid[1]
## uid can be obtained from the typeforms data set above
q = get_questionnaire(uid, api)

The object q contains a few useful components,

q$questions
q$completed
q$uncompleted

There are a number of options for downloading the data. For example

## Only completed forms
get_questionnaire(uid, api, completed = TRUE)
 
## Results since the 1st Jan
get_questionnaire(uid, api, since = as.Date("2016-01-01"))

See the ?get_questionnaire() help page for other options.

Example: Multiple Filters / Order

Imagine we only want to fetch the last 10 completed responses.

  • We only want completed results, so we add the parameter completed = TRUE.
  • The results need to be ordered by newest results first, so we add the parameter order_by = "date_submit_desc"
  • We only want a maximum of 10 results, so we add the parameter limit = 10

This gives the function call

get_questionnaire(uid, 
                  api, 
                  completed = TRUE, 
                  order_by = "date_submit_desc", 
                  limit = 10)

Other information

  • If you have any suggestions or find bugs, please use the github issue tracker.
  • Feel free to submit pull requests.

Development of this package was supported by Jumping Rivers

News

Version 0.3.3

  • More consistent response with get_typeforms().
  • Bug fix: Return an empty data frame when there are no typeforms (very edge case).
  • Bug fix: typeform API insists on integers for times; so use times.

Version 0.3.2

  • Bug fix: Return an empty data frame when there are no completed responses.
  • Bug fix: Parse hidden fields correctly

Version 0.3.1

  • Improved error messages for http status codes.
  • More consistent response with get_questionnaire().

Version 0.3.0

  • Breaking changes to the API. get_results() now depreciated. Instead, use get_questionnaire(). This returns a list with http_status, question stats, questions, completed, and uncompleted responses (thanks to @hrbrmstr).

Version 0.2.1

  • Adding automatic type conversion in the get_results() function (thanks to @1beb).

Version 0.2.0

  • Adding user agent to API call.
  • Better error handling.
  • Export get_api function.

Version 0.1.1

  • Minor tweaks for CRAN.

Version 0.1.0

  • Initial release.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rtypeform")

0.3.3 by Colin Gillespie, 3 months ago


https://github.com/csgillespie/rtypeform


Report a bug at https://github.com/csgillespie/rtypeform/issues


Browse source code at https://github.com/cran/rtypeform


Authors: Colin Gillespie [aut, cre]


Documentation:   PDF Manual  


GPL-2 | GPL-3 license


Imports jsonlite, httr, purrr, utils, tibble

Suggests testthat, curl, dplyr


See at CRAN