Skip to contents

Finds pattern (plain text, not a regular expression) in the documents and codes either the match itself or the whole segment containing it. Places already coded with this code (same range) are skipped. All new codings form one action: one undo removes them all again. Useful for deductive codes that are tied to clear terms – and for a first pass that is then checked by hand.

Usage

qda_autocode(
  pattern,
  code,
  scope = c("match", "segment"),
  source = NULL,
  ignore_case = TRUE,
  whole_word = FALSE,
  memo = ""
)

Arguments

pattern

Search term (plain text).

code

Code id or unique label.

scope

"match" (only the found words) or "segment" (the whole segment, e.g. the speaker turn, around each match).

source

Optional source(s) (ids or names); default all.

ignore_case

Logical.

whole_word

Logical; only whole words (default: also inside words).

memo

Optional comment for every new coding.

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("Project")
qda_autocode("project", code = "Project")                      # the matches
qda_autocode("project", code = "Project", scope = "segment")   # whole segments
qda_codings()[, c("code", "start", "end")]
#> # A tibble: 4 × 3
#>   code    start   end
#>   <chr>   <int> <int>
#> 1 Project   205   325
#> 2 Project   270   276
#> 3 Project   650   856
#> 4 Project   825   831
qda_close()