Skip to contents

Nettskjemar connects to version 3 of the nettskjema api, and the main functionality here is to download data from a form into R. Once you have created a nettskjema client, and set up your Renvironment locally, you can start accessing your forms.

General recommendations

While functions to download data also have the option to turn off the codebook, i.e. return the data with the original questions as column names, this is not recommended. Working with data in R in this format is very unpredictable, and we cannot guarantee that the functions in this package will act as expected.

Therefore, you are highly advised if you are using this package, to turn on the codebook in the Nettskjema portal for your form, and setting up a codebook for the entire form.

You can toggle the codebook for a form by going to the Nettskjema portal and entering your form. Then proceed to “Settings” and then “General settings”, and make sure “Codebook activated” is set to “Yes”. Once this is toggled, you will need to setup the codebook, either manually (advised) or by using the pre-filling functionality in Nettskjema.

You can read more about the details around the codebook on the UiO webpages (only available in Norwegian).

Tidyverse compatible

The data returns in this package are developed to be tidyverse-compatible. This means that those who are familiar with tidyverse, should find working with the data as retrieved from this package fairly easy. If you want to learn about the tidyverse and how to use it, there are excellent resources for that on the Tidyverse webpage.

Download submissions

Perhaps at the core of this package is the ability to download submission answers to a form into a tibble (variation of a data.frame).

library(nettskjemar)
formid <- 123823

data <- ns_get_data(formid)
data
#>   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.0
#>   number_integer slider attachment_1 attachment_2 $answer_time_ms
#> 1           77.0      3    sølvi.png                        74630
#> 2           45.0      1               marius.jpeg           71313
#> 3           98.0      9                                     70230

You will notice three columns that are prefixed with $. These are columns automatically added by the Nettskjema backend to your data, and the prefix is used to denote exactly this.

If you’d like to have labelled data, similar to that of SPSS and Stata, have a look at the vignette on labelled data for more information about that.

Fetching Raw Data

Raw answers come in a very different format than the data as seen in the codebook and preview in Nettskjema portal. The raw data have a timestamped format, per question for each submission. This means the data comes in a tall format (many rows per submission) rather than a wide format (one row per submission). The raw data may provide those who have keen interest in the time a users spent between each question. The data.frame this output will have one column that indicates which question the row is for, and another which is the response to that question.

# Fetch raw data
ns_get_data(formid, type = "long")
#>    formid formId submissionId  answerId elementId externalElementId
#> 1  123823 123823     27685292 158263133   1641697          freetext
#> 2  123823 123823     27685292 158263124   1641698             radio
#> 3  123823 123823     27685292 158263127   1641699          checkbox
#> 4  123823 123823     27685292 158263135   1641700          dropdown
#> 5  123823 123823     27685292 158263130   1641701      radio_matrix
#> 6  123823 123823     27685292 158263132   1641701      radio_matrix
#> 7  123823 123823     27685292 158263128   1641701      radio_matrix
#> 8  123823 123823     27685292 158263121   1641702   checkbox_matrix
#> 9  123823 123823     27685292 158263125   1641702   checkbox_matrix
#> 10 123823 123823     27685292 158263122   1641703              date
#> 11 123823 123823     27685292 158263123   1641704              time
#> 12 123823 123823     27685292 158263136   1641705          datetime
#> 13 123823 123823     27685292 158263126   1641706    number_decimal
#> 14 123823 123823     27685292 158263131   1641707    number_integer
#> 15 123823 123823     27685292 158263129   3472259            slider
#> 16 123823 123823     27685292 158263134   1641713      attachment_1
#> 17 123823 123823     27685302 158263178   1641697          freetext
#> 18 123823 123823     27685302 158263182   1641698             radio
#> 19 123823 123823     27685302 158263177   1641699          checkbox
#> 20 123823 123823     27685302 158263186   1641700          dropdown
#> 21 123823 123823     27685302 158263184   1641701      radio_matrix
#> 22 123823 123823     27685302 158263179   1641701      radio_matrix
#> 23 123823 123823     27685302 158263171   1641701      radio_matrix
#> 24 123823 123823     27685302 158263181   1641702   checkbox_matrix
#> 25 123823 123823     27685302 158263173   1641702   checkbox_matrix
#> 26 123823 123823     27685302 158263175   1641703              date
#> 27 123823 123823     27685302 158263176   1641704              time
#> 28 123823 123823     27685302 158263183   1641705          datetime
#> 29 123823 123823     27685302 158263180   1641706    number_decimal
#> 30 123823 123823     27685302 158263172   1641707    number_integer
#> 31 123823 123823     27685302 158263174   3472259            slider
#> 32 123823 123823     27685302 158263185   3525020      attachment_2
#> 33 123823 123823     27685319 158263284   1641698             radio
#> 34 123823 123823     27685319 158263290   1641699          checkbox
#> 35 123823 123823     27685319 158263291   1641700          dropdown
#> 36 123823 123823     27685319 158263283   1641701      radio_matrix
#> 37 123823 123823     27685319 158263282   1641701      radio_matrix
#> 38 123823 123823     27685319 158263289   1641701      radio_matrix
#> 39 123823 123823     27685319 158263293   1641702   checkbox_matrix
#> 40 123823 123823     27685319 158263288   1641702   checkbox_matrix
#> 41 123823 123823     27685319 158263294   1641703              date
#> 42 123823 123823     27685319 158263285   1641704              time
#> 43 123823 123823     27685319 158263281   1641705          datetime
#> 44 123823 123823     27685319 158263287   1641706    number_decimal
#> 45 123823 123823     27685319 158263286   1641707    number_integer
#> 46 123823 123823     27685319 158263292   3472259            slider
#>          textAnswer                      answerOptionIds
#> 1         some text                                     
#> 2              <NA>                              3879435
#> 3              <NA>                     3879437, 3879438
#> 4              <NA>                              3879439
#> 5              <NA>                              3879441
#> 6              <NA>                              3879442
#> 7              <NA>                              3879442
#> 8              <NA>                     3879443, 3879444
#> 9              <NA>                             13309370
#> 10       01.06.2023                                     
#> 11            12:00                                     
#> 12 12.06.2023 13:33                                     
#> 13              4,5                                     
#> 14               77                                     
#> 15                3                                     
#> 16        sølvi.png                                     
#> 17   another answer                                     
#> 18             <NA>                              3879436
#> 19             <NA>                             13309366
#> 20             <NA>                              3879440
#> 21             <NA>                             13309369
#> 22             <NA>                             13309369
#> 23             <NA>                              3879441
#> 24             <NA>                             13309372
#> 25             <NA>                   13309370, 13309371
#> 26       07.02.2023                                     
#> 27            14:45                                     
#> 28 15.02.2024 08:55                                     
#> 29              2,2                                     
#> 30               45                                     
#> 31                1                                     
#> 32      marius.jpeg                                     
#> 33             <NA>                              3879436
#> 34             <NA>           3879437, 3879438, 13309366
#> 35             <NA>                              3879439
#> 36             <NA>                              3879441
#> 37             <NA>                              3879441
#> 38             <NA>                              3879441
#> 39             <NA>                    3879444, 13309372
#> 40             <NA> 3879443, 3879444, 13309370, 13309371
#> 41       28.09.2022                                     
#> 42            05:11                                     
#> 43 03.03.2022 07:29                                     
#> 44               10                                     
#> 45               98                                     
#> 46                9                                     
#>         externalAnswerOptionIds     elementType         createdDate
#> 1                                      QUESTION 2023-06-01T20:57:15
#> 2                             1           RADIO 2023-06-01T20:57:15
#> 3        questionnaires, events        CHECKBOX 2023-06-01T20:57:15
#> 4                             4          SELECT 2023-06-01T20:57:15
#> 5                             1    MATRIX_RADIO 2023-06-01T20:57:15
#> 6                             2    MATRIX_RADIO 2023-06-01T20:57:15
#> 7                             2    MATRIX_RADIO 2023-06-01T20:57:15
#> 8                 IT, colleague MATRIX_CHECKBOX 2023-06-01T20:57:15
#> 9                         admin MATRIX_CHECKBOX 2023-06-01T20:57:15
#> 10                                         DATE 2023-06-01T20:57:15
#> 11                                         DATE 2023-06-01T20:57:15
#> 12                                         DATE 2023-06-01T20:57:15
#> 13                                       NUMBER 2023-06-01T20:57:15
#> 14                                       NUMBER 2023-06-01T20:57:15
#> 15                                 LINEAR_SCALE 2023-06-01T20:57:15
#> 16                                   ATTACHMENT 2023-06-01T20:57:15
#> 17                                     QUESTION 2023-06-01T20:58:33
#> 18                           -1           RADIO 2023-06-01T20:58:33
#> 19                         logs        CHECKBOX 2023-06-01T20:58:33
#> 20                            9          SELECT 2023-06-01T20:58:33
#> 21                            3    MATRIX_RADIO 2023-06-01T20:58:33
#> 22                            3    MATRIX_RADIO 2023-06-01T20:58:33
#> 23                            1    MATRIX_RADIO 2023-06-01T20:58:33
#> 24                     internet MATRIX_CHECKBOX 2023-06-01T20:58:33
#> 25                 admin, union MATRIX_CHECKBOX 2023-06-01T20:58:33
#> 26                                         DATE 2023-06-01T20:58:33
#> 27                                         DATE 2023-06-01T20:58:33
#> 28                                         DATE 2023-06-01T20:58:33
#> 29                                       NUMBER 2023-06-01T20:58:33
#> 30                                       NUMBER 2023-06-01T20:58:33
#> 31                                 LINEAR_SCALE 2023-06-01T20:58:33
#> 32                                   ATTACHMENT 2023-06-01T20:58:33
#> 33                           -1           RADIO 2023-06-01T20:59:50
#> 34 questionnaires, events, logs        CHECKBOX 2023-06-01T20:59:50
#> 35                            4          SELECT 2023-06-01T20:59:50
#> 36                            1    MATRIX_RADIO 2023-06-01T20:59:50
#> 37                            1    MATRIX_RADIO 2023-06-01T20:59:50
#> 38                            1    MATRIX_RADIO 2023-06-01T20:59:50
#> 39          colleague, internet MATRIX_CHECKBOX 2023-06-01T20:59:50
#> 40  IT, colleague, admin, union MATRIX_CHECKBOX 2023-06-01T20:59:50
#> 41                                         DATE 2023-06-01T20:59:50
#> 42                                         DATE 2023-06-01T20:59:50
#> 43                                         DATE 2023-06-01T20:59:50
#> 44                                       NUMBER 2023-06-01T20:59:50
#> 45                                       NUMBER 2023-06-01T20:59:50
#> 46                                 LINEAR_SCALE 2023-06-01T20:59:50
#>           modifiedDate subElementId answerAttachmentId    filename  mediaType
#> 1  2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 2  2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 3  2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 4  2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 5  2023-06-01T20:57:15      1649734                 NA        <NA>       <NA>
#> 6  2023-06-01T20:57:15      1649735                 NA        <NA>       <NA>
#> 7  2023-06-01T20:57:15      5973024                 NA        <NA>       <NA>
#> 8  2023-06-01T20:57:15      1649736                 NA        <NA>       <NA>
#> 9  2023-06-01T20:57:15      1649737                 NA        <NA>       <NA>
#> 10 2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 11 2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 12 2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 13 2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 14 2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 15 2023-06-01T20:57:15           NA                 NA        <NA>       <NA>
#> 16 2023-06-01T20:57:15           NA             538819   sølvi.png  image/png
#> 17 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 18 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 19 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 20 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 21 2023-06-01T20:58:33      1649734                 NA        <NA>       <NA>
#> 22 2023-06-01T20:58:33      1649735                 NA        <NA>       <NA>
#> 23 2023-06-01T20:58:33      5973024                 NA        <NA>       <NA>
#> 24 2023-06-01T20:58:33      1649736                 NA        <NA>       <NA>
#> 25 2023-06-01T20:58:33      1649737                 NA        <NA>       <NA>
#> 26 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 27 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 28 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 29 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 30 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 31 2023-06-01T20:58:33           NA                 NA        <NA>       <NA>
#> 32 2023-06-01T20:58:33           NA             538820 marius.jpeg image/jpeg
#> 33 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#> 34 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#> 35 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#> 36 2023-06-01T20:59:50      1649734                 NA        <NA>       <NA>
#> 37 2023-06-01T20:59:50      1649735                 NA        <NA>       <NA>
#> 38 2023-06-01T20:59:50      5973024                 NA        <NA>       <NA>
#> 39 2023-06-01T20:59:50      1649736                 NA        <NA>       <NA>
#> 40 2023-06-01T20:59:50      1649737                 NA        <NA>       <NA>
#> 41 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#> 42 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#> 43 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#> 44 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#> 45 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#> 46 2023-06-01T20:59:50           NA                 NA        <NA>       <NA>
#>      size attachment.answerAttachmentId attachment.filename
#> 1      NA                            NA                <NA>
#> 2      NA                            NA                <NA>
#> 3      NA                            NA                <NA>
#> 4      NA                            NA                <NA>
#> 5      NA                            NA                <NA>
#> 6      NA                            NA                <NA>
#> 7      NA                            NA                <NA>
#> 8      NA                            NA                <NA>
#> 9      NA                            NA                <NA>
#> 10     NA                            NA                <NA>
#> 11     NA                            NA                <NA>
#> 12     NA                            NA                <NA>
#> 13     NA                            NA                <NA>
#> 14     NA                            NA                <NA>
#> 15     NA                            NA                <NA>
#> 16 628613                        538819           sølvi.png
#> 17     NA                            NA                <NA>
#> 18     NA                            NA                <NA>
#> 19     NA                            NA                <NA>
#> 20     NA                            NA                <NA>
#> 21     NA                            NA                <NA>
#> 22     NA                            NA                <NA>
#> 23     NA                            NA                <NA>
#> 24     NA                            NA                <NA>
#> 25     NA                            NA                <NA>
#> 26     NA                            NA                <NA>
#> 27     NA                            NA                <NA>
#> 28     NA                            NA                <NA>
#> 29     NA                            NA                <NA>
#> 30     NA                            NA                <NA>
#> 31     NA                            NA                <NA>
#> 32  89494                        538820         marius.jpeg
#> 33     NA                            NA                <NA>
#> 34     NA                            NA                <NA>
#> 35     NA                            NA                <NA>
#> 36     NA                            NA                <NA>
#> 37     NA                            NA                <NA>
#> 38     NA                            NA                <NA>
#> 39     NA                            NA                <NA>
#> 40     NA                            NA                <NA>
#> 41     NA                            NA                <NA>
#> 42     NA                            NA                <NA>
#> 43     NA                            NA                <NA>
#> 44     NA                            NA                <NA>
#> 45     NA                            NA                <NA>
#> 46     NA                            NA                <NA>
#>    attachment.mediaType attachment.size
#> 1                  <NA>              NA
#> 2                  <NA>              NA
#> 3                  <NA>              NA
#> 4                  <NA>              NA
#> 5                  <NA>              NA
#> 6                  <NA>              NA
#> 7                  <NA>              NA
#> 8                  <NA>              NA
#> 9                  <NA>              NA
#> 10                 <NA>              NA
#> 11                 <NA>              NA
#> 12                 <NA>              NA
#> 13                 <NA>              NA
#> 14                 <NA>              NA
#> 15                 <NA>              NA
#> 16            image/png          628613
#> 17                 <NA>              NA
#> 18                 <NA>              NA
#> 19                 <NA>              NA
#> 20                 <NA>              NA
#> 21                 <NA>              NA
#> 22                 <NA>              NA
#> 23                 <NA>              NA
#> 24                 <NA>              NA
#> 25                 <NA>              NA
#> 26                 <NA>              NA
#> 27                 <NA>              NA
#> 28                 <NA>              NA
#> 29                 <NA>              NA
#> 30                 <NA>              NA
#> 31                 <NA>              NA
#> 32           image/jpeg           89494
#> 33                 <NA>              NA
#> 34                 <NA>              NA
#> 35                 <NA>              NA
#> 36                 <NA>              NA
#> 37                 <NA>              NA
#> 38                 <NA>              NA
#> 39                 <NA>              NA
#> 40                 <NA>              NA
#> 41                 <NA>              NA
#> 42                 <NA>              NA
#> 43                 <NA>              NA
#> 44                 <NA>              NA
#> 45                 <NA>              NA
#> 46                 <NA>              NA

Raw data cannot be labelled, and no other alterations have been made to the data. They come exactly as the API returns them, so you may do what you need with them.

Controlling checkbox output

The Nettskjema survey tool includes the possibility to create a matrix of checkboxes, i.e. giving the respondents the ability to select several options within a question. Checkboxes are returned as binary columns, one columns per checkbox where 1 indicates that the checkbox was ticked.

We provide some extra functionality to help work with these data. Currently we only support working with the checkbox matrix questions, but are working on a solution for all checkboxes.

ns_get_data(formid) |>
  ns_alter_checkbox(
    to = "list"
  )
#>   $submission_id formid                  $created       freetext radio
#> 1       27685292 123823 2023-06-01T20:57:15+02:00      some text     1
#> 2       27685302 123823 2023-06-01T20:58:33+02:00 another answer    -1
#> 3       27685319 123823 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       date  time
#> 1                   1                    2                  2 2023-06-01 12:00
#> 2                   3                    3                  1 2023-02-07 14:45
#> 3                   1                    1                  1 2022-09-28 05:11
#>           datetime number_decimal number_integer slider attachment_1
#> 1 2023-06-12T13:33            4.5           77.0      3    sølvi.png
#> 2 2024-02-15T08:55            2.2           45.0      1             
#> 3 2022-03-03T07:29           10.0           98.0      9             
#>   attachment_2 $answer_time_ms   checkbox_matrix.1           checkbox_matrix.2
#> 1                        74630       colleague, IT                       admin
#> 2  marius.jpeg           71313            internet                admin, union
#> 3                        70230 colleague, internet admin, colleague, IT, union

These can be separated into rows if wanted, using tidyverse syntax.

library(tidyr)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

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


# Turns list column, into rows
ns_get_data(formid) |>
  ns_alter_checkbox(
    to = "list"
  ) |>
  unnest(checkbox_matrix.1) |>
  relocate(checkbox_matrix.1, .after = 2)
#> # A tibble: 5 × 23
#>   `$submission_id` formid checkbox_matrix.1 `$created`            freetext radio
#>              <int>  <dbl> <chr>             <chr>                 <chr>    <int>
#> 1         27685292 123823 colleague         2023-06-01T20:57:15+… "some t…     1
#> 2         27685292 123823 IT                2023-06-01T20:57:15+… "some t…     1
#> 3         27685302 123823 internet          2023-06-01T20:58:33+… "anothe…    -1
#> 4         27685319 123823 colleague         2023-06-01T20:59:50+… ""          -1
#> 5         27685319 123823 internet          2023-06-01T20:59:50+… ""          -1
#> # ℹ 17 more variables: checkbox.questionnaires <int>, checkbox.events <int>,
#> #   checkbox.logs <int>, dropdown <int>, radio_matrix.grants <int>,
#> #   radio_matrix.lecture <int>, radio_matrix.email <int>, date <chr>,
#> #   time <chr>, datetime <chr>, number_decimal <chr>, number_integer <chr>,
#> #   slider <int>, attachment_1 <chr>, attachment_2 <chr>,
#> #   `$answer_time_ms` <int>, checkbox_matrix.2 <list>

If you are not used to working with list columns, another option is to work with delimited strings in columns. In this procedure, you can turn the checkboxes into a character column, where each option in separated by a character of your choosing.

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

# Turns string column, into rows
ns_get_data(formid) |>
  ns_alter_checkbox(
    to = "character",
    sep = ";"
  ) |>
  relocate(checkbox_matrix.1, .after = 2) |>
  separate_rows(checkbox_matrix.1)
#> # A tibble: 5 × 23
#>   `$submission_id` formid checkbox_matrix.1 `$created`            freetext radio
#>              <int>  <dbl> <chr>             <chr>                 <chr>    <int>
#> 1         27685292 123823 colleague         2023-06-01T20:57:15+… "some t…     1
#> 2         27685292 123823 IT                2023-06-01T20:57:15+… "some t…     1
#> 3         27685302 123823 internet          2023-06-01T20:58:33+… "anothe…    -1
#> 4         27685319 123823 colleague         2023-06-01T20:59:50+… ""          -1
#> 5         27685319 123823 internet          2023-06-01T20:59:50+… ""          -1
#> # ℹ 17 more variables: checkbox.questionnaires <int>, checkbox.events <int>,
#> #   checkbox.logs <int>, dropdown <int>, radio_matrix.grants <int>,
#> #   radio_matrix.lecture <int>, radio_matrix.email <int>, date <chr>,
#> #   time <chr>, datetime <chr>, number_decimal <chr>, number_integer <chr>,
#> #   slider <int>, attachment_1 <chr>, attachment_2 <chr>,
#> #   `$answer_time_ms` <int>, checkbox_matrix.2 <chr>