Skip to contents

Turns a survey export (SoSci Survey, LimeSurvey, Qualtrics, Google Forms ... saved as CSV or Excel) into documents: one document per respondent, in it every open answer as its own segment (the question as the first line, the answer below), and chosen columns as document variables – ready for coding, case comparison and queries by group. With code_questions = TRUE every answer is already coded with a code for its question (all below one code "Fragen" / "Questions"), so you can filter and compare by question right away.

Usage

qda_import_survey(
  file,
  text = NULL,
  vars = NULL,
  id = NULL,
  sheet = 1,
  code_questions = FALSE,
  prefix = NULL,
  name = NULL,
  pseudonyms = NULL
)

Arguments

file

Path to a .csv or .xlsx file.

text

Columns with open answers. Default: as suggested by qda_survey_columns().

vars

Columns to store as document variables. Default: as suggested.

id

Column with the respondent id; default as suggested, otherwise the row number.

sheet

Excel sheet.

code_questions

Logical; code every answer with a code for its question.

prefix

Start of the document names (default: the file name), e.g. "survey" gives survey_017.

name

File name to use for originals/ and the default prefix (e.g. the original name of an upload).

pseudonyms

Optional key list (see qda_pseudonyms()): names in the answers, the ids and the variable values are replaced before the text is frozen; the survey file is then not copied to originals/.

Value

Invisibly, a tibble of the new documents (id, name, format, chars, status), like qda_import(). Attribute "skipped": number of respondents without answers or already imported.

Details

Empty answers are left out; respondents without any open answer are skipped. Importing the same file again skips respondents already imported. The survey file is copied to originals/.

Examples

qda_open(file.path(tempfile(), "survey.jellyqda"))
f <- system.file("extdata", "survey_demo.csv", package = "jellyqda")
qda_survey_columns(f)
#> # A tibble: 9 × 6
#>   column                               role  answers distinct mean_chars example
#>   <chr>                                <chr>   <int>    <int>      <dbl> <chr>  
#> 1 respondent                           id         12       12        7   "DEMO_…
#> 2 submitted                            igno…      12       12       16   "2027-…
#> 3 age_group                            vari…      12        3        4.5 "18-21"
#> 4 field_of_study                       vari…      12        3       13.1 "Envir…
#> 5 semester                             vari…      12        7        1   "1"    
#> 6 Why did you choose your field of st… text       11        6       62.7 "I wan…
#> 7 What causes you stress during your … text       11        8       68.6 "Deadl…
#> 8 What would help you most?            text        9        6       40.8 "Finan…
#> 9 Satisfaction with your studies (1-5) vari…      12        5        1   "2"    
qda_import_survey(f, code_questions = TRUE)
qda_sources()[, c("name", "segments")]
#> # A tibble: 11 × 2
#>    name                segments
#>    <chr>                  <int>
#>  1 survey_demo_DEMO_01        3
#>  2 survey_demo_DEMO_02        3
#>  3 survey_demo_DEMO_03        3
#>  4 survey_demo_DEMO_04        3
#>  5 survey_demo_DEMO_05        3
#>  6 survey_demo_DEMO_06        2
#>  7 survey_demo_DEMO_07        3
#>  8 survey_demo_DEMO_08        3
#>  9 survey_demo_DEMO_09        2
#> 10 survey_demo_DEMO_10        3
#> 11 survey_demo_DEMO_12        3
qda_source_vars(1)
#>                            age_group                       field_of_study 
#>                              "18-21"                   "Computer science" 
#>                             semester Satisfaction with your studies (1-5) 
#>                                  "1"                                  "2" 
qda_close()