A ManifestoDocument represents a document from the Manifesto Corpus and contains
text, coding and meta information.
ManifestoDocument objects need not be constructed manually but are the content
of the ManifestoCorpus
objects downloaded from the Manifesto
Corpus Database API via mp_corpus
.
ManifestoDocument
s subclass the TextDocument
class
from the package tm
. Hence they can be and usually are collected in a tm
Corpus
to interface easily with text mining and other linguistic
analysis functions. manifestoR
uses the subclass
ManifestoCorpus
of tm
s Corpus
, but
ManifestoDocument
s can be stored in any kind of Corpus
.
As in tm
any ManifestoDocument has metadata which can be accessed and
modified via the meta
function, as well as content, accessible via
content
. Additionally, via codes()
, the coding of the
(quasi-)sentence ccording to the CMP category scheme can be accessed
(and modified). The CMP category scheme can be found online at
https://manifesto-project.wzb.eu/coding_schemes/mp_v4 (version 4)
or https://manifesto-project.wzb.eu/coding_schemes/mp_v5 (version 5).
ManifestoDocument(
content = data.frame(),
id = character(0),
meta = ManifestoDocumentMeta()
)
data.frame of text and codes for the ManifestoDocument to be constructed.
There can be multiple columns of codes, but by default the accessor method codes
searches for the column named "cmp_code".
an id to identify the Document
an object of class ManifestoDocumentMeta
containing the metadata for this document
Internally, a ManifestoDocument is a data.frame
with a row for
every quasi-sentence and the columns text
and code
.
# NOT RUN {
corpus <- mp_corpus(subset(mp_maindataset(), countryname == "New Zealand"))
doc <- corpus[[1]]
print(doc)
# }
Run the code above in your browser using DataLab