Learn R Programming

nettskjemar

The goal of {nettskjemar} is to have easy access to data and form information on the Nettskjema service by the University of Oslo, Norway. Currently the main possibilities is help in creating users and tokens for accessing Nettskjema through its API, downloading meta-data and codebooks about specific forms and data associated with a specific form.

Install the released version from CRAN with:

install.packages("nettskjemar")

Newer releases can be installed through the authors r-universe:

# Enable this universe
options(repos = c(
    lcbc_uio = 'https://CAPRO-UIO.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'))

# Install some packages
install.packages('nettskjemar')

Install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("CAPRO-UIO/nettskjemar")

Example

Currently, the package contains functions to download data from forms, including submission answers, meta-data, and codebook information. The most important, is the function that will download nettskjema submission data and return them as a data.frame. This needs only the id of a nettskjema.

library(nettskjemar)

ns_get_data(123823)
#>   formid $submission_id                  $created       freetext radio
#> 1 123823       27685292 2023-06-01T20:57:15+02:00      some text     1
#> 2 123823       27685302 2023-06-01T20:58:33+02:00 another answer    -1
#> 3 123823       27685319 2023-06-01T20:59:50+02:00                   -1
#>   checkbox.questionnaires checkbox.events checkbox.logs dropdown
#> 1                       1               1             0        4
#> 2                       0               0             1        9
#> 3                       1               1             1        4
#>   radio_matrix.grants radio_matrix.lecture radio_matrix.email
#> 1                   1                    2                  2
#> 2                   3                    3                  1
#> 3                   1                    1                  1
#>   checkbox_matrix.1.IT checkbox_matrix.1.colleague checkbox_matrix.1.admin
#> 1                    1                           1                       0
#> 2                    0                           0                       0
#> 3                    0                           1                       0
#>   checkbox_matrix.1.union checkbox_matrix.1.internet checkbox_matrix.2.IT
#> 1                       0                          0                    0
#> 2                       0                          1                    0
#> 3                       0                          1                    1
#>   checkbox_matrix.2.colleague checkbox_matrix.2.admin checkbox_matrix.2.union
#> 1                           0                       1                       0
#> 2                           0                       1                       1
#> 3                           1                       1                       1
#>   checkbox_matrix.2.internet       date  time         datetime number_decimal
#> 1                          0 2023-06-01 12:00 2023-06-12T13:33            4.5
#> 2                          0 2023-02-07 14:45 2024-02-15T08:55            2.2
#> 3                          0 2022-09-28 05:11 2022-03-03T07:29             10
#>   number_integer slider attachment_1 attachment_2 $answer_time_ms
#> 1             77      3    sølvi.png                        74630
#> 2             45      1               marius.jpeg           71313
#> 3             98      9                                     70230

Documentation

Package documentation can be found on the associated GitHub pages, where there are 7 tutorials.

Citation

To cite nettskjemar in publications use:

Athanasia Monika Mowinckel. (2021, May 10). LCBC-UiO/nettskjemar: v0.1.04 (Version v0.1.04). Zenodo. http://doi.org/10.5281/zenodo.4745481

A BibTeX entry for LaTeX users is

@Manual{, title = {nettskjemar - Package to work with University of Oslo Nettskjema API}, author = {Athanasia Mo Mowinckel}, year = {2021}, month = {05}, day = {10}, doi = {10.5281/zenodo.4745481}, }

Funding

This tool is partly funded by:

EU Horizon 2020 Grant: Healthy minds 0-100 years: Optimising the use of European brain imaging cohorts (Lifebrain).

Grant agreement number: 732592.

Call: Societal challenges: Health, demographic change and well-being

Copy Link

Version

Install

install.packages('nettskjemar')

Monthly Downloads

572

Version

1.0.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Athanasia Mo Mowinckel

Last Published

March 18th, 2025

Functions in nettskjemar (1.0.1)

codebook

Constructor for nettskjema codebook
ns_alter_checkbox

Alter checkbox matrix variables in a dataset
ns_list_form_attachments

Retrieve all attachments associated with a Nettskjema
ns_get_submission_attachments

Get Nettskjema attachments for a submission
has_codebook

Check if form has codebook
ns_get_forms

Get all forms you have access to
ns_get_me

Information about the current user
ns_get_attachment

Save Nettskjema attachments to file
ns_auth_token

Retrieve access token
ns_get_meta

Get metadata for a form
ns_get_submission

Get an individual submission answer
get_raw_codebook

Get the raw codebook
nettskjemar-package

nettskjemar: Connect to the 'nettskjema.no' API of the University of Oslo
ns_write_codebook

Write codebook to file
ns_get_codebook

Get codebook for a form
ns_get_data

Get data from a form
ns_req

Basic Nettskjema httr2 request
ns_get_form_attachments

Retrieve all attachments associated with a Nettskjema
ns_get_form_reports

Download files associated with a form
ns_list_submission_attachments

List Nettskjema attachments for a submission
ns_write_meta

Write meta-data to file
ns_add_labels

Add Labels to Dataset
ns_api_docs

Access Nettskjema API Documentation
ns_create_client

Create a Nettskjema Client