Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
Buildinginteractiveandreproduciblereportsinminutes
IntroductiontoRMarkdown
Yan-holtz.com/teaching
What
“AnRMarkdown(.Rmd)fileisarecordofyourresearch.Itcontainsthecode thatascientistneedstoreproduceyourworkalongwiththenarration thatareader
needstounderstandyourwork.“
Why
• Efficiency• Reproducibility• Interactivity• Automation• Notebook
Andmuchmore..
MostBasicDocument
1- OpenRstudio:
• UserFriendlyenvironment• Autocompletion• RunalineofcodewithCmd +Enter
2- Opena.Rmd file:
Anatomyofa.Rmd file:
Header
Title
Text
Codechunk
3- Knitthe.Rmd file:
.html.rmd4- .HTML
outputisready
• Havealooktoyourcurrentdirectory
• Openthe.htmlinabrowser
header
TitleText
Code
Coderesult
Customize text
Customizethetext
RMarkdowncheatsheet
bit.ly/1SuNTo9
Codechunk options
AnatomyofaCodechunk:
Optional:chunk nameR,bash,
python?
Chunkoptions
Run allpreviouschunks
Run thischunk
Commentyour code
Codechunkoptions:
Donotalwaysrunthewholedocument
à RMarkdowndocumentis aNotebook!!
Header
Anatomyoftheheader:
Going further
Insertatable:theDTlibrary
Dataframe
UseInteractivecharts
Plotly library
Basicggplot2graphic
Ggplotly turn theplotinteractive
Result:zoom/hover /export..Andmore
http://www.htmlwidgets.org
Useatemplate• ThePCTGtemplate:www.github.com/holtzy/epuRate
Pimpmy.Rmd
• holtzy.github.io/Pimp-my-rmd/
• Everything is possible
• UseCSSandHTMLcode
• Add headerandfooter
• More
Sharing
Outputformat?
Word.doc.pdf
Book
TemplateDashboard
Slides
Blog
Shareyouranalysis
• Mailwithcolleagues,supervisor
• Publicationasasupplementarymaterial
• Github:www.github.com
• Website
Example
Anexample:mybioinfo pipeline:
• Interactionwith clusters
• Oneuniquefolder
• Several .rmd wrapped inawebsite
• Shared online
Thanks
bit.ly/2SxJFlVSlides:
bit.ly/2AZySd9Cheat Sheet:
bit.ly/2QDX7HzPimp my rmd:
www.yan-holtz.com
@R_Graph_Gallery
github.com/holtzy