Skip to content

Commit d39921a

Browse files
committed
print num matrix items
1 parent 6adb7d3 commit d39921a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

facebook/qsf-tools/generate-codebook.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ process_qsf <- function(path_to_qsf,
2424
q <- read_json(path_to_qsf)
2525
wave <- get_wave(path_to_qsf)
2626

27-
block_id_item_map <- map_qids_to_module(q)
2827
displayed_questions <- subset_qsf_to_displayed(q)
2928

3029
# get Qualtrics auto-assigned question IDs
@@ -164,6 +163,7 @@ process_qsf <- function(path_to_qsf,
164163
response_option_randomization = response_option_randomization)
165164

166165
# Add on module randomization
166+
block_id_item_map <- map_qids_to_module(q)
167167
block_id_item_map <- block_id_item_map %>%
168168
left_join(data.frame(qid=qids, item=item_names), by=c("Questions"="qid"))
169169
qdf <- qdf %>% left_join(block_id_item_map, by=c(variable="item")) %>%
@@ -238,7 +238,7 @@ process_qsf <- function(path_to_qsf,
238238

239239
qdf <- bind_rows(nonmatrix_items, matrix_items)
240240

241-
# indicate which items have replaced old items.
241+
# indicate which new items have replaced old items.
242242
replaces_map <- read_csv(path_to_replacement_map,
243243
col_types = cols(new_item = col_character(),
244244
old_item = col_character()

facebook/qsf-tools/list-matrix-items.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ print_matrix_items <- function(path_to_qsf, survey_version=c("CMU", "UMD")) {
2323
# Get survey item names
2424
item_names <- displayed_questions %>%
2525
map_chr(~ .x$Payload$DataExportTag) %>%
26-
patch_item_names(item_names, survey_version, wave)
26+
patch_item_names(survey_version, wave)
2727

2828
# Get survey item formats
2929
qtype <- get_question_formats(displayed_questions, item_names, survey_version)
3030

3131
qdf <- tibble(variable = item_names,
3232
type = qtype)
3333

34-
print(qdf %>% filter(type == "Matrix") %>% pull(variable))
34+
matrix_items <- qdf %>% filter(type == "Matrix") %>% pull(variable)
35+
message("Wave ", wave, " has ", length(matrix_items), " matrix items: ", paste(matrix_items, collapse=", "))
3536

3637
return(NULL)
3738
}

0 commit comments

Comments
 (0)