Skip to contents

This function merges multiple objects of class conc into one conc object.

Usage

merge_conc(..., show_warnings = TRUE)

Arguments

...

Two or more objects of class conc.

show_warnings

Logical. If FALSE, warnings are suppressed.

Value

An object of class conc.

Examples

(cd_1 <- conc('A first very small corpus.', '\\w+', as_text = TRUE))
#> Concordance-based data frame (number of observations: 5)
#> idx                                     left|match |right                   
#>   1                                         |  A   |first very small corpus.
#>   2                                        A|first |very small corpus.      
#>   3                                  A first| very |small corpus.           
#>   4                             A first very|small |corpus.                 
#>   5                       A first very small|corpus|.                       
#> 
#> This data frame has 6 columns:
#>    column
#> 1 glob_id
#> 2      id
#> 3  source
#> 4    left
#> 5   match
#> 6   right
as.data.frame(cd_1)
#>   glob_id id source                left  match                     right
#> 1       1  1      -                          A  first very small corpus.
#> 2       2  2      -                  A   first        very small corpus.
#> 3       3  3      -            A first    very             small corpus.
#> 4       4  4      -       A first very   small                   corpus.
#> 5       5  5      - A first very small  corpus                         .

(cd_2 <- conc('A second very small corpus.', '\\w+', as_text = TRUE))
#> Concordance-based data frame (number of observations: 5)
#> idx                                    left|match |right                    
#>   1                                        |  A   |second very small corpus.
#>   2                                       A|second|very small corpus.       
#>   3                                A second| very |small corpus.            
#>   4                           A second very|small |corpus.                  
#>   5                     A second very small|corpus|.                        
#> 
#> This data frame has 6 columns:
#>    column
#> 1 glob_id
#> 2      id
#> 3  source
#> 4    left
#> 5   match
#> 6   right
(cd_3 <- conc('A third very small corpus.', '\\w+', as_text = TRUE))
#> Concordance-based data frame (number of observations: 5)
#> idx                                     left|match |right                   
#>   1                                         |  A   |third very small corpus.
#>   2                                        A|third |very small corpus.      
#>   3                                  A third| very |small corpus.           
#>   4                             A third very|small |corpus.                 
#>   5                       A third very small|corpus|.                       
#> 
#> This data frame has 6 columns:
#>    column
#> 1 glob_id
#> 2      id
#> 3  source
#> 4    left
#> 5   match
#> 6   right
(cd <- merge_conc(cd_1, cd_2, cd_3))
#> Concordance-based data frame (number of observations: 15)
#> idx                                    left|match |right                    
#>   1                                        |  A   |first very small corpus. 
#>   2                                       A|first |very small corpus.       
#>   3                                 A first| very |small corpus.            
#>   4                            A first very|small |corpus.                  
#>   5                      A first very small|corpus|.                        
#>   6                                        |  A   |second very small corpus.
#>   7                                       A|second|very small corpus.       
#>   8                                A second| very |small corpus.            
#>   9                           A second very|small |corpus.                  
#>  10                     A second very small|corpus|.                        
#>  11                                        |  A   |third very small corpus. 
#>  12                                       A|third |very small corpus.       
#>  13                                 A third| very |small corpus.            
#>  14                            A third very|small |corpus.                  
#>  15                      A third very small|corpus|.                        
#> 
#> This data frame has 6 columns:
#>    column
#> 1 glob_id
#> 2      id
#> 3  source
#> 4    left
#> 5   match
#> 6   right
as.data.frame(cd)
#>    glob_id id source                 left  match                      right
#> 1        1  1      -                           A   first very small corpus.
#> 2        2  2      -                   A   first         very small corpus.
#> 3        3  3      -             A first    very              small corpus.
#> 4        4  4      -        A first very   small                    corpus.
#> 5        5  5      -  A first very small  corpus                          .
#> 6        6  1      -                           A  second very small corpus.
#> 7        7  2      -                   A  second         very small corpus.
#> 8        8  3      -            A second    very              small corpus.
#> 9        9  4      -       A second very   small                    corpus.
#> 10      10  5      - A second very small  corpus                          .
#> 11      11  1      -                           A   third very small corpus.
#> 12      12  2      -                   A   third         very small corpus.
#> 13      13  3      -             A third    very              small corpus.
#> 14      14  4      -        A third very   small                    corpus.
#> 15      15  5      -  A third very small  corpus                          .