31 lines
2.4 KiB
Plaintext
31 lines
2.4 KiB
Plaintext
# Workflow: RMarkdown
|
|
|
|
You have seen three basic workflows:
|
|
|
|
1. Work in console.
|
|
1. Work with a single script.
|
|
1. Work with multiple scripts in a project.
|
|
|
|
R Markdown introduces a four workflow: instead of writing R scripts in the script editor, you write R Markdown documents. The chief advantage of this workflow is it put prose and code on an equal footing. That is obviously important if you're writing up a report to share with someone else. But it's equally important when you're working on a data analysis that's just for you because it provides a great environment to develop you code, and record your thoughts as they occur. It allows you to a modern day lab notebook --- you record everything you tried as you try it. You notebooks only need to be understandable by you.
|
|
|
|
Knitting an `.Rmd` is also great reproduciblility practice because every time you knit it, it's done in a completely fresh session. If you always finish the day by knitting your `.Rmd` and making sure it works, then you're doing reproducible research!
|
|
|
|
R Markdown provides a useful way to organize your data science projects. You can use an R Markdown file to create a reproducible record of how you import, tidy, transform, visualise, and model data.
|
|
|
|
and then generate a report from your .Rmd file to communicate your results. This process is very efficient: you can write your report once and then deploy it many times in different formats or with different parameters. Moreover, by creating an R Markdown file, you participate in two movements that are leading to better scientific practices:
|
|
|
|
1. **Reproducible Research** - The familiar scientific report format
|
|
(*Introduction*, *Methods and Materials*, *Results*, *Discussion* and
|
|
*Conclusion*) helps experimental scientists report their results in a
|
|
reproducible way. Embedded in the format are the details that a scientist
|
|
would need to reproduce the experiment.
|
|
|
|
R Markdown files provide the same service for data science. Embedded in
|
|
the file is the code that a data scientist would need to repeat your analysis.
|
|
|
|
2. **Literate Data Analysis** - like
|
|
[literate programming](https://en.wikipedia.org/wiki/Literate_programming),
|
|
literate data analysis intermingles code with human-readable text to build
|
|
a program that is easy to understand and easy to debug (and often more
|
|
streamlined than a program written in a non-literate way).
|