Skip to contents

Takes documents, codes, codings, memos, variables, summary grid cells and cases from another jellyqda project – typically the copy a team member coded – into the open project. Documents are recognised by their text, codes by their path; nothing that is already there is added twice, and where both projects have a different value (a variable, a summary) the open project keeps its own and the difference is counted as a conflict.

Usage

qda_merge(other, add_documents = TRUE, dry_run = FALSE, backup = TRUE)

Arguments

other

Path to the other .jellyqda file.

add_documents

Logical; also add documents that exist only in the other project (default TRUE). With FALSE their codings are skipped.

dry_run

Logical; only report what would be merged.

backup

Logical; write a backup before merging (default TRUE).

Value

A tibble with one row per kind of data: what, added, already (already there, skipped) and conflicts. Attributes "file" and "dry_run".

Details

Run it with dry_run = TRUE first to see what would be added. A real merge writes a backup of the open project first (qda_backup()); it is not undone with qda_undo() but by restoring that backup. The other file is only read.

See also

qda_intercoder_copy() to hand out copies, qda_intercoder_adopt() to take over single codings

Examples

dir <- tempfile()
qda_open(file.path(dir, "team.jellyqda"))
qda_import(system.file("extdata", c("interview_01.txt", "interview_02.md"), package = "jellyqda"))
#> # A tibble: 2 × 5
#>      id name             format chars status
#>   <int> <chr>            <chr>  <int> <chr> 
#> 1     1 interview_01.txt txt      856 ok    
#> 2     2 interview_02.md  md       531 ok    
qda_code_add("Career path"); qda_code_add("Team")
copy <- qda_intercoder_copy(file.path(dir, "anna.jellyqda"))   # a copy for Anna
qda_code(1, "Team", segment = 3)                                 # you code document 1
qda_close()
qda_open(copy)                                                   # Anna codes document 2
qda_code(2, "Career path", segment = 2); qda_code_add("Motivation")
qda_code(2, "Motivation", segment = 4)
qda_close()
qda_open(file.path(dir, "team.jellyqda"))
qda_merge(copy, dry_run = TRUE)                                  # what would happen?
#> # A tibble: 7 × 4
#>   what      added already conflicts
#>   <chr>     <int>   <int>     <int>
#> 1 documents     0       2         0
#> 2 codes         1       2         0
#> 3 codings       2       0         0
#> 4 memos         0       0         0
#> 5 variables     0       0         0
#> 6 summaries     0       0         0
#> 7 cases         0       0         0
qda_merge(copy)
#> # A tibble: 7 × 4
#>   what      added already conflicts
#>   <chr>     <int>   <int>     <int>
#> 1 documents     0       2         0
#> 2 codes         1       2         0
#> 3 codings       2       0         0
#> 4 memos         0       0         0
#> 5 variables     0       0         0
#> 6 summaries     0       0         0
#> 7 cases         0       0         0
qda_codings()[, c("source", "code")]
#> # A tibble: 3 × 2
#>   source           code       
#>   <chr>            <chr>      
#> 1 interview_01.txt Team       
#> 2 interview_02.md  Career path
#> 3 interview_02.md  Motivation 
qda_close()