knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Reading Paradise Lost from the EEBO version, and looking for the most distinguishing words in each book.
library(TEIdytext) library(tidytext) fname = system.file("extdata", "ParadiseLost.xml", package="TEIdytext") data = TEIdy(fname) data %>% select(plaintext, div.book.n) %>% unnest_tokens(word, plaintext) %>% mutate(div.book.n = as.numeric(div.book.n)) %>% group_by(div.book.n, word) %>% summarize(count=n()) %>% bind_tf_idf(word, div.book.n, count) %>% arrange(div.book.n, -tf_idf) %>% slice(1:6) %>% ggplot() + geom_point(aes(x=div.book.n, y=word, size=count)) + scale_size_continuous(trans='sqrt') + facet_wrap(~div.book.n, scales='free_y')
data %>% filter(!is.na(author))
act1 %>% unnest_tokens(word, text) %>% group_by(`sp-who`) %>% summarize(count=n()) header = tree %>% xpl(1) %>% to_frame colnas = . %>% apply(., 2, function(col) sum(is.na(col))) %>% order reselect = function(frame) { neworder = frame %>% colnas; frame[neworder] } header %>% filter(!is.na(`sex-value`)) %>% reselect() macbeth = tree %>% to_frame library(tidytext) framed = d %>% to_frame %>% unnest_tokens(word, text) library(ggplot2) framed %>% group_by(stage, word) %>% summarize(count=n()) %>% arrange(-count) %>% ggplot() + geom_bar(aes(x=word, y = count, fill=stage), position="dodge", stat="identity") + coord_flip() + facet_wrap(~stage)
You can enable figure captions by fig_caption: yes
in YAML:
output: rmarkdown::html_vignette: fig_caption: yes
Then you can use the chunk option fig.cap = "Your figure caption."
in knitr.
You can write math expressions, e.g. $Y = X\beta + \epsilon$, footnotes^[A footnote here.], and tables, e.g. using knitr::kable()
.
knitr::kable(head(mtcars, 10))
Also a quote using >
:
"He who gives up [code] safety for [code] speed deserves neither." (via)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.