A bundle is used to combine several objects (partition, context,
features, cooccurrences objects) into one S4 class object. Typically,
a class inheriting from the bundle superclass will be used. When working with a
context_bundle, a features_bundle, a cooccurrences_bundle, or a
context_bundle, a similar set of standard methods is available to perform
transformations.
# S4 method for bundle name(x) <- value # S4 method for bundle length(x) # S4 method for bundle names(x) # S4 method for bundle,vector names(x) <- value # S4 method for bundle unique(x) # S4 method for bundle,bundle +(e1, e2) # S4 method for bundle,textstat +(e1, e2) # S4 method for bundle [[(x, i) # S4 method for bundle [[(x, i) <- value # S4 method for bundle $(x, name) # S4 method for bundle $(x, name) <- value # S4 method for bundle sample(x, size) # S4 method for list as.bundle(object, ...) # S4 method for textstat as.bundle(object) # S3 method for bundle as.data.table(x, keep.rownames, col, ...) # S4 method for bundle as.matrix(x, col) # S4 method for bundle subset(x, ...) # S4 method for bundle as.list(x) # S3 method for bundle as.list(x, ...) # S4 method for bundle get_corpus(x)
| x | a bundle object |
|---|---|
| value | character string with a name to be assigned |
| e1 | object 1 |
| e2 | object 2 |
| i | An |
| name | The name of an object in the |
| size | number of items to choose to generate a sample |
| object | A |
| ... | Further parameters |
| keep.rownames | Required argument to safeguard consistency with S3
method definition in the |
| col | columns of the |
corpusThe CWB corpus the objects in the bundle are based on, a length 1
character vector.
objectsAn object of class list.
p_attributeObject of class character.
encodingThe encoding of the corpus.
Andreas Blaette
parties <- s_attributes("GERMAPARLMINI", "party") parties <- parties[-which(parties == "NA")] party_bundle <- partition_bundle("GERMAPARLMINI", s_attribute = "party") length(party_bundle)#> [1] 6#> [1] "B90_DIE_GRUENEN" "CDU_CSU" "DIE_LINKE" "FDP" #> [5] "NA" "SPD"#> [1] "GERMAPARLMINI"#> name size p_attribute unique #> 1 B90_DIE_GRUENEN 23052 word 4186 #> 2 CDU_CSU 66490 word 8486 #> 3 DIE_LINKE 22542 word 4531 #> 4 FDP 31505 word 4930 #> 5 NA 31310 word 5032 #> 6 SPD 47302 word 6692#> name size p_attribute unique #> 1 CDU_CSU 66490 word 8486 #> 2 SPD 47302 word 6692#>#>#> [1] "B90_DIE_GRUENEN" "CDU_CSU" "DIE_LINKE" "FDP" #> [5] "NA" "SPD"#> [1] "B90_DIE_GRUENEN" "CDU_CSU" "DIE_LINKE" "FDP" #> [5] "SPD"pb <- partition_bundle("GERMAPARLMINI", s_attribute = "party") pb$SPD # access partition names "SPD" in partition_bundle pb#>#>#>#>#>#>#>#>#>#>pb <- partition_bundle("GERMAPARLMINI", s_attribute = "party") pb$"NA" <- NULL # quotation needed if name is "NA" use("polmineR")#>#>pb <- partition_bundle("REUTERS", s_attribute = "id") coocs <- cooccurrences(pb, query = "oil", cqp = FALSE)#> Warning: No hits for query oil (returning NULL)