File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
facebook/delphiFacebook/R Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ split_options <- function(column) {
19
19
20
20
# ' Test if a specific selection is selected
21
21
# '
22
+ # ' Checking whether a specific selection is selected in either "" (empty
23
+ # ' string) or `NA` responses will produce `NA`s.
24
+ # '
22
25
# ' @param vec A list whose entries are character vectors, such as c("14", "15").
23
26
# ' @param selection one string, such as "14"
24
27
# ' @return a logical vector; for each list entry, whether selection is contained
@@ -28,8 +31,10 @@ is_selected <- function(vec, selection) {
28
31
vec ,
29
32
function (resp ) {
30
33
if (length(resp ) == 0 || all(is.na(resp ))) {
31
- # All our selection items include "None of the above" or similar, so
32
- # treat no selection the same as missingness.
34
+ # Qualtrics files code no selection as "" (empty string), which is
35
+ # parsed by `read_csv` as `NA` (missing) by default. Since all our
36
+ # selection items include "None of the above" or similar, treat both no
37
+ # selection ("") or missing (NA) as missing, for generality.
33
38
NA
34
39
} else {
35
40
selection %in% resp
You can’t perform that action at this time.
0 commit comments