Quick start

Kim Seonghyun

2017-06-05

Installation

Either you try stable CRAN version

install.packages("tropr")

Or unstable development version

devtools::install_github("zedoul/tropr")

You’ll need to use library to load as follows:

library(tropr)

Get Content

library(tropr)

.url <- "http://tvtropes.org/pmwiki/pmwiki.php/Main/SenseiChan"
content <- trope_content(.url)
.df <- as.data.frame(content)
head(.df[, c("category", "link")])
##   category                                                           link
## 1     main          http://tvtropes.org/pmwiki/pmwiki.php/Main/HotTeacher
## 2     main                 http://tvtropes.org/pmwiki/pmwiki.php/Main/Moe
## 3     main         http://tvtropes.org/pmwiki/pmwiki.php/Main/CoolTeacher
## 4     main       http://tvtropes.org/pmwiki/pmwiki.php/Main/ChristmasCake
## 5     main http://tvtropes.org/pmwiki/pmwiki.php/Main/DudeWheresMyRespect
## 6     main        http://tvtropes.org/pmwiki/pmwiki.php/Main/OneOfTheKids

The output is tidy, so that you can easily turn them into a plot as follows:

library(ggplot2)
q <- ggplot(.df, aes(category)) + geom_bar() +
       coord_flip() + ylab("Freq") + xlab("")
plot(q)