Reproducible Science for Busy Researchers: How to Save Time using Literate Programming
2022-08-23
Index
0.1 Things to add
Signe recommended students run a live tutorial in swirl
Google Analytics
https://benmarwick.github.io/bookdown-ort/mods.html#google-analytics
0.3 Andrew’s Resources
These resources are not relevant for students but they are to me.
- Book on editing your gitbook
- Decent breakdown on creating your own book
- https://slides.yihui.org/2017-rmarkdown-UNL-Yihui-Xie.html#1
- This post incorporates several types (YouTube, GitBook, GIF, learnr) into one gitbook export. I’m not sure how he did it so the code might be revealing.
- Breakdown of RMarkdown
0.3.1 Styling your docx template
- Great detailed description on SO
- Using flextable for custom table layouts in Word
0.4 Andrew’s Notes / Ramblings
- It might be easier to consider making this a website. There’s a really nice example using Hugo which would allow me to embed presentations. I’m not sure how I feel about it. I really like Google Slides because they are so easy to create but it might be a way to embed YouTube videos along with presentations and learnR modules all in one place. I have it forked on my GitHub
To render the book used the following code, you must do this before knitting the GitBook (webpage)
::render_book("index.Rmd", "bookdown::gitbook")
bookdown::render_book("index.Rmd", "bookdown::pdf_book", encoding="UTF-8")
bookdown::render_book("index.Rmd", "bookdown::epub_book")
bookdown
# after previewing the book
#Which is done by running these lines
::serve_book()
bookdown
# To stop the process run (or you can restart your session)
::daemon_stop("981593464") servr
The _output.yml
contains the header arguments. I would but them here so its cleaner and easier to read the code.
0.5 To Do
Is there a way I can have matlab code syntax highlighted properly? Maybe here
Make a logo
Get Camera to take nice pictures
Create example datasets that I can run through
Can I export this to github.io? The GitHub Repository for this guidebook can be found here
Add highlight arg to
_output.yml
There should be a section on general access to your df. How to manipulate it effectively (perhaps in the data wrangling section) This would include things like using
df$colname to access a column
Implement Open Review which will allow people to make comments. An example can be seen here
Finish my changes
Push my commits to GitHub
Open a pull request
Cleaned the main directory to make it easier to interpret for beginners
Look into adding content from both the Workshop and Data Battles there is useful slides in both. In DataBattles I show a breakdown of functions which might be useful for new users.
I also have content from a mixed model workshop I hosted (the one Ashley asked me to run)
For Chapter @ref(#data-wrangling)
0.6 Title word cloud
Titles: inquiry-based R for researchers in a hurry Reproducible science. Reproducible science for the busy researcher.
0.7 Copy from Chapter 1 Example
You can label chapter and section titles using {#label}
after them, e.g., we can reference Chapter \@ref(intro)
. If you do not manually label them, there will be automatic labels anyway, e.g., Chapter \@ref(methods)
.
Figures and tables with captions will be placed in figure
and table
environments, respectively.
par(mar = c(4, 4, .1, .1))
plot(pressure, type = 'b', pch = 19)
Reference a figure by its code chunk label with the fig:
prefix, e.g., see Figure \@ref(fig:nice-fig)
. Similarly, you can reference tables generated from knitr::kable()
, e.g., see Table \@ref(tab:nice-tab)
.
::kable(
knitrhead(iris, 20), caption = 'Here is a nice table!',
booktabs = TRUE
)
You can write citations, too. For example, we are using the bookdown package in this sample book, which was built on top of R Markdown and knitr .
0.8 MATLAB Highlighting
% This is a comment in MATLAB
function y = average(x)
if ~isvector(x)
error('Input must be a vector')
end
y = sum(x)/length(x);
end
So could this
0.9 CSS / Templates
https://bookdown.org/yihui/bookdown/templates.html https://rstudio4edu.github.io/rstudio4edu-book/book-dress.html github.com/hebrewseniorlife/bookdownThemeEditor
In the terminal I ran
git config –global user.name ‘alapo’ git config –global user.email ‘alapo@umich.edu’
git config –global user.name ‘Jane Doe’ git config –global user.email ‘jane@example.com’
0.10 Teaching RStudio
I created this course to work backwards from traditional methods.
Students will learn the basics of RMarkdown first and then learn how to insert chunks within it. I do this for a few reasons
- They are able to see the end result immediately
- Most students are going to be using another program while taking this course, so its a start
- We can use static images and datasets to insert figures and tables into our RMarkdown document
0.11 Misc code/data
gitbook(fig_caption = TRUE, number_sections = TRUE, self_contained = FALSE,
lib_dir = "libs", pandoc_args = NULL, ..., template = "default",
split_by = c("chapter", "chapter+number", "section", "section+number",
"rmd", "none"), split_bib = TRUE, config = list(), table_css = TRUE)
0.12 Other Resources
Book called Just Enough R
An example on how to use GitHub with student projects. Really nice breakdown that is worth a read.
Allison Horst on Twitter has some amazing images that I may want to use
This is a course outline similar to what I want