Skip to contents

Turns the result of qda_query() into codings: every hit (segment or document) is coded with code. A code that does not exist yet is created first (as a top-level code, or below parent). The codings form one action: Ctrl+Z / qda_undo() removes them again (and a second undo the new code). Hits that already carry this code over the same range are skipped.

Usage

qda_query_to_code(hits, code, parent = NULL)

Arguments

hits

Result of qda_query().

code

Code (path or unique label) or the label of a new code.

parent

For a new code: its parent code (optional).

Value

Invisibly, a tibble of the new codings.

Examples

qda_open(file.path(tempfile(), "example.jellyqda"))
qda_import(system.file("extdata", "interview_01.txt", package = "jellyqda"))
#> # A tibble: 1 × 5
#>      id name             format chars status
#>   <int> <chr>            <chr>  <int> <chr> 
#> 1     1 interview_01.txt txt      856 ok    
qda_code_add("Career path"); qda_code_add("Motivation")
qda_code(1, "Career path", segment = 5); qda_code(1, "Motivation", segment = 5)
hits <- qda_query(all = c("Career path", "Motivation"))
qda_query_to_code(hits, "Career and motivation")
qda_codings()[, c("code", "start", "end")]
#> # A tibble: 3 × 3
#>   code                  start   end
#>   <chr>                 <int> <int>
#> 1 Career path             373   605
#> 2 Motivation              373   605
#> 3 Career and motivation   373   605
qda_close()