Super simple way to add formating to plain text
Created by John Gruber (of Daring Fireball) as a simple way for non-programming types to write in an easy-to-read format that could be converted directly into HTML.
boston_payroll %>%
group_by(TITLE) %>%
summarise_each(funs(mean), REGULAR, OVERTIME)
An R Markdown (.Rmd) file is a record of your analysis process.
It contains the code that a scientist needs to reproduce your work along with the narration that a reader needs to understand your work.
The idea that data analyses, and more generally, stories, are published with their data and software code so that others may verify the findings and build upon them.
At the click of a button, or the type of a command, you can rerun the code in an R Markdown file to reproduce your work and export the results as a finished report.
R Markdown supports dozens of static and dynamic output formats including
at File > New File > R Markdown.
Title the R Markdown file and select HTML as the output for now.
YAML HEADER
Optional section of render options written as key:value pairs.
CODE CHUNKS
Chunks of embedded R code. Each chunk:
TEXT
Narration formatted with markdown mixed with code chunks.
Edit the default template by putting in your own code and text.
Intersperse the text with your code to tell a story.
You’ll see why in a moment.
You can run individual chunks of code before generating the full report to see how it looks.
Click the green arrow next to each chunk.
Use knit button or type render() to knit
Down in the console. Warnings and errors will appear.
Also measures progress by chunks, which is why it’s important to label them.
You have a .Rmd file and clicking knit HTML also generated a .html file
You need to load libraries just like you would a normal script.
Let’s look at the data in R Markdown with a new package called DT
that uses the Datatables jquery library.
Example from Part 1 in the chunks.MD
file.
Adding warning=F
and message=F
hid the little messages.
Example from Part 2 in the chunks.MD
file.
If the person you’re sharing this with has no interest in the code and only the quick results, use echo=F
to hide the chunk of code and just display the output.
Example from Part 3 in the chunks.MD
file.
Embed lines of R code within the narrative with
Example from Part 4 in the chunks.MD
file.
Make pretty tables with the knitr
package and the kable
function.
Example from Part 5 in the chunks.MD
file.
Change the appearance and style of the HTML document by changing the theme up top.
Options from the Bootswatch theme library includes:
default
cerulean
journal
cosmo
highlights
tango
pygments
kate
Example from Part 6 in the chunks.MD
file.
Add a floating table of contents by changing html_document
to toc: true
and toc_float: true
.
Example from Part 7 in the chunks.MD
file.
Exporting as a PDF will require LaTex installed first * Get it from latex-project.org or MacTex
Check out all the features of R Markdown at RStudio
Publish your results to Github pages
Read more on how
Try to publish directly to Wordpress
I haven’t actually made this work but maybe you can try