A subcorpus_bundle object combines a set of subcorpus objects in a list in the the slot objects. The class inherits from the partition_bundle and the bundle class. Typically, a subcorpus_bundle is generated by applying the split-method on a corpus or subcorpus.

# S4 method for subcorpus_bundle
show(object)

# S4 method for subcorpus_bundle
merge(x, name = "", verbose = FALSE)

# S4 method for subcorpus
merge(x, y, ...)

# S4 method for subcorpus
split(
  x,
  s_attribute,
  values = NULL,
  prefix = "",
  mc = getOption("polmineR.mc"),
  verbose = TRUE,
  progress = FALSE,
  type = get_type(x)
)

# S4 method for corpus
split(
  x,
  s_attribute,
  values = NULL,
  prefix = "",
  mc = getOption("polmineR.mc"),
  verbose = TRUE,
  progress = FALSE,
  type = get_type(x),
  xml = "flat"
)

# S4 method for subcorpus_bundle
split(
  x,
  s_attribute,
  prefix = "",
  progress = TRUE,
  mc = getOption("polmineR.mc")
)

Arguments

object

An object of class subcorpus_bundle.

x

A corpus, subcorpus, or subcorpus_bundle object.

name

The name of the new subcorpus object.

verbose

Logical, whether to provide progress information.

y

A subcorpus to be merged with x.

...

Further subcorpus objects to be merged with x and y.

s_attribute

The s-attribute to vary.

values

Values the s-attribute provided shall assume.

prefix

A character vector that will be attached as a prefix to partition names.

mc

Logical, whether to use multicore parallelization.

progress

Logical, whether to show progress bar.

type

The type of partition to generate.

xml

A logical value.

Details

Applying the split-method to a subcorpus_bundle-object will iterate through the subcorpus, and apply split on each subcorpus object in the bundle, splitting it up by the s-attribute provided by the argument s_attribute. The return value is a subcorpus_bundle, the names of which will be the names of the incoming partition_bundle concatenated with the s-attribute values used for splitting. The argument prefix can be used to achieve a more descriptive name.

Examples

corpus("REUTERS") %>% split(s_attribute = "id") %>% summary()
#> name size #> 1 127 92 #> 2 144 444 #> 3 191 55 #> 4 194 69 #> 5 211 93 #> 6 236 465 #> 7 237 434 #> 8 242 164 #> 9 246 331 #> 10 248 349 #> 11 273 378 #> 12 349 92 #> 13 352 105 #> 14 353 103 #> 15 368 110 #> 16 489 149 #> 17 502 199 #> 18 543 83 #> 19 704 282 #> 20 708 53
# Merge multiple subcorpus objects a <- corpus("GERMAPARLMINI") %>% subset(date == "2009-10-27") b <- corpus("GERMAPARLMINI") %>% subset(date == "2009-10-28") c <- corpus("GERMAPARLMINI") %>% subset(date == "2009-11-10") y <- merge(a, b, c) s_attributes(y, "date")
#> [1] "2009-10-27" "2009-10-28" "2009-11-10"
sc <- subset("GERMAPARLMINI", date == "2009-11-11") b <- split(sc, s_attribute = "speaker") p <- partition("GERMAPARLMINI", date = "2009-11-11")
#> ... get encoding: latin1
#> ... get cpos and strucs
y <- partition_bundle(p, s_attribute = "speaker") gparl <- corpus("GERMAPARLMINI") b <- split(gparl, s_attribute = "date") # split up objects in partition_bundle by using partition_bundle-method use("polmineR")
#> ... activating corpus: GERMAPARLMINI (version: 0.0.1 | build date: 2019-02-23)
#> ... activating corpus: REUTERS
y <- corpus("GERMAPARLMINI") %>% split(s_attribute = "date") %>% split(s_attribute = "speaker") summary(y)
#> name size #> 1 2009-10-27_Gerda Hasselfeldt 23 #> 2 2009-10-27_Heinz Riesenhuber 4766 #> 3 2009-10-27_Hermann Otto Solms 17 #> 4 2009-10-27_Katrin Göring-Eckardt 17 #> 5 2009-10-27_Norbert Lammert 4441 #> 6 2009-10-27_Petra Pau 25 #> 7 2009-10-27_Volker Kauder 38 #> 8 2009-10-27_Wolfgang Thierse 14 #> 9 2009-10-28_Angela Dorothea Merkel 127 #> 10 2009-10-28_Annette Schavan 10 #> 11 2009-10-28_Dirk Niebel 10 #> 12 2009-10-28_Franz Josef Jung 10 #> 13 2009-10-28_Guido Westerwelle 10 #> 14 2009-10-28_Ilse Aigner 10 #> 15 2009-10-28_Karl-Theodor zu Guttenberg 10 #> 16 2009-10-28_Norbert Lammert 2519 #> 17 2009-10-28_Peter Ramsauer 10 #> 18 2009-10-28_Philipp Rösler 10 #> 19 2009-10-28_Rainer Brüderle 10 #> 20 2009-10-28_Ronald Pofalla 27 #> 21 2009-10-28_Sabine Leutheusser-Schnarrenberger 10 #> 22 2009-10-28_Ursula von der Leyen 10 #> 23 2009-10-28_Wolfgang Schäuble 10 #> 24 2009-11-10_Agnes Krumwiede 779 #> 25 2009-11-10_Andreas Schockenhoff 2825 #> 26 2009-11-10_Angela Dorothea Merkel 8988 #> 27 2009-11-10_Angelica Schwall-Düren 1230 #> 28 2009-11-10_Arnold Vaatz 1603 #> 29 2009-11-10_Birgit Homburger 4311 #> 30 2009-11-10_Caren Lay 702 #> 31 2009-11-10_Christel Happach-Kasan 1336 #> 32 2009-11-10_Dirk Niebel 1409 #> 33 2009-11-10_Elvira Drobinski-Weiß 1062 #> 34 2009-11-10_Frank-Walter Steinmeier 4476 #> 35 2009-11-10_Frithjof Schmidt 1264 #> 36 2009-11-10_Gerda Hasselfeldt 350 #> 37 2009-11-10_Gernot Erler 1210 #> 38 2009-11-10_Guido Westerwelle 1566 #> 39 2009-11-10_Hans-Michael Goldmann 1239 #> 40 2009-11-10_Hans-Peter Friedrich 759 #> 41 2009-11-10_Ilse Aigner 1321 #> 42 2009-11-10_Jan van Aken 1364 #> 43 2009-11-10_Joachim Poß 1772 #> 44 2009-11-10_Johannes Röring 1081 #> 45 2009-11-10_Jürgen Trittin 2477 #> 46 2009-11-10_Karl-Theodor zu Guttenberg 3016 #> 47 2009-11-10_Katrin Göring-Eckardt 519 #> 48 2009-11-10_Kirsten Tackmann 1009 #> 49 2009-11-10_Norbert Lammert 365 #> 50 2009-11-10_Omid Nouripour 812 #> 51 2009-11-10_Oskar Lafontaine 3337 #> 52 2009-11-10_Peter Bleser 1778 #> 53 2009-11-10_Petra Pau 81 #> 54 2009-11-10_Sascha Raabe 199 #> 55 2009-11-10_Ulrike Höfken 1374 #> 56 2009-11-10_Volker Kauder 3956 #> 57 2009-11-10_Waltraud Wolff 1490 #> 58 2009-11-10_Wilhelm Priesmeier 1252 #> 59 2009-11-10_Wolfgang Gehrcke 1291 #> 60 2009-11-10_Wolfgang Thierse 4713 #> 61 2009-11-11_Albert Rupprecht 1055 #> 62 2009-11-11_Annette Schavan 2048 #> 63 2009-11-11_Anton Schaaf 332 #> 64 2009-11-11_Bärbel Höhn 1671 #> 65 2009-11-11_Brigitte Pothmer 1795 #> 66 2009-11-11_Christine Lambrecht 1901 #> 67 2009-11-11_Dagmar Ziegler 4073 #> 68 2009-11-11_Daniela Raab 1506 #> 69 2009-11-11_Dieter Wiefelspütz 1268 #> 70 2009-11-11_Dirk Fischer 1301 #> 71 2009-11-11_Dorothée Menzner 772 #> 72 2009-11-11_Ekin Deligöz 1665 #> 73 2009-11-11_Elke Ferner 2053 #> 74 2009-11-11_Ernst Dieter Rossmann 1721 #> 75 2009-11-11_Eva Bulling-Schröter 854 #> 76 2009-11-11_Florian Pronold 1327 #> 77 2009-11-11_Frank Schwabe 1279 #> 78 2009-11-11_Franz Josef Jung 1653 #> 79 2009-11-11_Georg Nüßlein 2277 #> 80 2009-11-11_Gerda Hasselfeldt 636 #> 81 2009-11-11_Gisela Piltz 1775 #> 82 2009-11-11_Günter Krings 40 #> 83 2009-11-11_Halina Wawzyniak 524 #> 84 2009-11-11_Hans-Peter Uhl 1388 #> 85 2009-11-11_Hartfrid Wolff 1432 #> 86 2009-11-11_Heidrun Bluhm 1045 #> 87 2009-11-11_Heinrich Leonhard Kolb 2016 #> 88 2009-11-11_Hermann Otto Solms 4001 #> 89 2009-11-11_Horst Meierhofer 1366 #> 90 2009-11-11_Hubertus Heil 6117 #> 91 2009-11-11_Jens Petermann 641 #> 92 2009-11-11_Jerzy Montag 1431 #> 93 2009-11-11_Joachim Pfeiffer 2051 #> 94 2009-11-11_Johannes Vogel 1072 #> 95 2009-11-11_Jörn Wunderlich 1855 #> 96 2009-11-11_Josef Göppel 746 #> 97 2009-11-11_Karl Schiewerling 2018 #> 98 2009-11-11_Katja Kipping 821 #> 99 2009-11-11_Katrin Göring-Eckardt 4281 #> 100 2009-11-11_Kerstin Andreae 2097 #> 101 2009-11-11_Klaus Ernst 1236 #> 102 2009-11-11_Krista Sager 1451 #> 103 2009-11-11_Marco Bülow 1355 #> 104 2009-11-11_Marie-Luise Dött 1195 #> 105 2009-11-11_Markus Kurth 92 #> 106 2009-11-11_Martin Neumann 771 #> 107 2009-11-11_Max Straubinger 1578 #> 108 2009-11-11_Michael Franz Wilhelm Fuchs 2361 #> 109 2009-11-11_Michael Grosse-Brömer 1530 #> 110 2009-11-11_Michael Kauch 1274 #> 111 2009-11-11_Michael Kretschmer 1489 #> 112 2009-11-11_Miriam Gruß 1540 #> 113 2009-11-11_Norbert Lammert 1724 #> 114 2009-11-11_Norbert Röttgen 2670 #> 115 2009-11-11_Olaf Scholz 3741 #> 116 2009-11-11_Patrick Döring 2144 #> 117 2009-11-11_Patrick Meinhardt 1398 #> 118 2009-11-11_Peter Götz 882 #> 119 2009-11-11_Peter Ramsauer 2168 #> 120 2009-11-11_Petra Pau 229 #> 121 2009-11-11_Petra Sitte 1810 #> 122 2009-11-11_Rainer Brüderle 1367 #> 123 2009-11-11_Raju Sharma 536 #> 124 2009-11-11_Reinhard Grindel 1407 #> 125 2009-11-11_Sabine Leidig 1048 #> 126 2009-11-11_Sabine Leutheusser-Schnarrenberger 1338 #> 127 2009-11-11_Sahra Wagenknecht 1063 #> 128 2009-11-11_Sören Bartol 1158 #> 129 2009-11-11_Ulla Jelpke 589 #> 130 2009-11-11_Ulla Lötzer 707 #> 131 2009-11-11_Ulrich Kelber 1243 #> 132 2009-11-11_Ursula von der Leyen 1846 #> 133 2009-11-11_Uwe Karl Beckmeyer 1170 #> 134 2009-11-11_Volker Beck 121 #> 135 2009-11-11_Winfried Hermann 1601 #> 136 2009-11-11_Wolfgang Thierse 272 #> 137 2009-11-11_Wolfgang Wieland 1606 #> 138 2009-11-12_Alexander Bonde 1096 #> 139 2009-11-12_Barbara Hendricks 22 #> 140 2009-11-12_Birgitt Bender 979 #> 141 2009-11-12_Carl-Ludwig Thiele 1572 #> 142 2009-11-12_Carola Reimann 1299 #> 143 2009-11-12_Elisabeth Scharfenberg 845 #> 144 2009-11-12_Elke Ferner 2965 #> 145 2009-11-12_Gerda Hasselfeldt 1923 #> 146 2009-11-12_Gesine Lötzsch 1313 #> 147 2009-11-12_Hermann Otto Solms 53 #> 148 2009-11-12_Jens Spahn 1434 #> 149 2009-11-12_Joachim Poß 1573 #> 150 2009-11-12_Norbert Lammert 326 #> 151 2009-11-12_Philipp Rösler 1636 #> 152 2009-11-12_Rolf Koschorrek 1671 #> 153 2009-11-12_Ulrike Flach 876 #> 154 2009-11-12_Wolfgang Schäuble 2921 #> 155 2009-11-12_Wolfgang Zöller 1633