Description Usage Arguments Value Note Examples
Reshape a extract_trend list output to long format with a term colun added.
Coerce a data.frame to a trend2long
object.
1 2 3 | trend2long(x, ...)
as.trend2long(x, ...)
|
x |
An extract_trend list output. |
... |
Currently ignored. |
returns a data.frame
of trend data by lookup terms.
Returns a a trend2long
object.
There is no object checking. It is the user's responsibility to make
sure the object being coerced correspondes to a trend2long
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Not run:
library(dplyr)
out <- gtrend_scraper("tyler.rinker@gmail.com", "password",
c("ebola", "sars", "hiv", "aids", "influenza", "flu", "the cold"))
as.zoo.gtrends(out[[1]])
trend2long(out) %>%
plot
library(dplyr)
trend2long(out) %>%
filter(term %in% c("hiv", "ebola", "sars")) %>%
as.trend2long %>%
plot
library(ggplot2)
trend2long(out) %>%
ggplot(aes(x=start, y=term, fill=trend)) +
geom_tile() +
scale_fill_gradient(low="black", high="white") +
scale_x_date(expand = c(0, 0)) +
theme_bw() + xlab("time")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.