plotScot {tosca} | R Documentation |
Plots Counts of Documents or Words over Time (relative to Corpus)
Description
Creates a plot of the counts/proportion of documents/words in the subcorpus,
which could be specified by id
.
Usage
plotScot(
object,
id = object$meta$id,
type = c("docs", "words"),
rel = FALSE,
mark = TRUE,
unit = "month",
curves = c("exact", "smooth", "both"),
smooth = 0.05,
main,
xlab,
ylab,
ylim,
both.lwd,
both.col,
both.lty,
natozero = TRUE,
file,
...
)
Arguments
object |
|
id |
Character: Vector (default: |
type |
Character: Should counts/proportion
of documents |
rel |
Logical: Should counts
(default: |
mark |
Logical: Should years be marked by
vertical lines (default: |
unit |
Character: To which unit should
dates be floored (default: |
curves |
Character: Should |
smooth |
Numeric: Smoothing parameter
which is handed over to |
main |
Character: Graphical parameter |
xlab |
Character: Graphical parameter |
ylab |
Character: Graphical parameter |
ylim |
Graphical parameter (default if |
both.lwd |
Graphical parameter for smoothed values if |
both.col |
Graphical parameter for smoothed values if |
both.lty |
Graphical parameter for smoothed values if |
natozero |
Logical: Should NAs be coerced
to zeros (default: |
file |
Character: File path if a pdf should be created. |
... |
additional graphical parameters |
Details
object
needs a textmeta object with strictly tokenized text component
(character vectors) if you use type = "words"
.
If you use type = "docs"
you can use a tokenized or a non-tokenized text component.
In fact, you can use the textmeta constructor
(textmeta(meta = <your-meta-data.frame>)
) to create a textmeta object
containing only the meta field and plot the resulting object.
This way you can save time and memory at the first glance.
Value
A plot
Invisible: A dataframe with columns date
and counts
,
respectively proportion
Examples
## Not run:
data(politics)
poliClean <- cleanTexts(politics)
# complete corpus
plotScot(object=poliClean)
# subcorpus
subID <- filterWord(poliClean, search=c("bush", "obama"), out="bin")
plotScot(object=poliClean, id=names(subID)[subID], curves="both", smooth=0.3)
## End(Not run)