
Last chance! 50% off unlimited learning
Sale ends in
Creates a stacked area plot of all or selected topics.
plotArea(
ldaresult,
ldaID,
select = NULL,
tnames = NULL,
threshold = NULL,
meta,
unit = "quarter",
xunit = "year",
color = NULL,
sort = TRUE,
legend = NULL,
legendLimit = 0,
peak = 0,
file
)
List of two matrices. rel
contains the topic proportions over time, relcum
contains the cumulated topic proportions
LDA result object
Character vector including IDs of the texts
Selects all topics if parameter is null. Otherwise vector of integers or topic label. Only topics belonging to that numbers, and labels respectively would be plotted.
Character vector of topic labels. It must have same length than number of topics in the model.
Numeric: Treshold between 0 and 1. Topics would only be used if at least one time unit exist with a topic proportion above the treshold
The meta data for the texts or a date-string.
Time unit for x-axis. Possible units are "bimonth"
, "quarter"
, "season"
,
"halfyear"
, "year"
, for more units see round_date
Time unit for tiks on the x-axis. For possible units see round_date
Color vector. Color vector would be replicated if the number of plotted topics is bigger than length of the vector.
Logical: Should the topics be sorted by topic proportion?
Position of legend. If NULL
(default), no legend will be plotted
Numeric between 0 (default) and 1. Only Topics with proportions above this limit appear in the legend.
Numeric between 0 (default) and 1. Label peaks above peak
. For each Topic every area which are at least once above peak
will e labeled. An area ends if the topic proportion is under 1 percent.
Character: File path if a pdf should be created
This function is useful to visualize the volume of topics and to show trends over time.
if (FALSE) {
data(politics)
poliClean <- cleanTexts(politics)
words10 <- makeWordlist(text=poliClean$text)
words10 <- words10$words[words10$wordtable > 10]
poliLDA <- LDAprep(text=poliClean$text, vocab=words10)
LDAresult <- LDAgen(documents=poliLDA, K=10, vocab=words10)
plotArea(ldaresult=LDAresult, ldaID=names(poliLDA), meta=politics$meta)
plotArea(ldaresult=LDAresult, ldaID=names(poliLDA), meta=politics$meta, select=c(1,3,5))
}
Run the code above in your browser using DataLab