This is a collection of document templates, available through R, from your friends at the University of Miami (UM). \(R+UM=rUM\)
The rUM
package will help you create research
manuscripts by removing the configuration hassles commonly encountered
when learning to write papers using R. rUM
will initialize
a new RStudio project and a Markdown file that includes the outline for
a research paper. The Markdown file comes preconfigured with a YAML
header (don’t worry if you don’t know what that means yet) with code
chunks to load the tidyverse
and conflicted
packages. Manuscript sections have been created for Introduction,
Methods, Results, Conclusion, and References. The project also includes
a .gitignore
file which is designed to help protect against
accidentally leaking data when using git with websites like www.github.com.
rUM’s documentation can be found here:
RMarkdown
and rUM
? (Add a
“quart o’ rUM
”!)Modern version RStudio (v2022.07 or later) ships with R Markdown integrated into the RStudio IDE.
Add rUM
to your computer by:
install.packages("rUM")
if (!requireNamespace("remotes")) install.packages("remotes")
::install_github("RaymondBalise/rUM") remotes
Use rUM
by running this in the console of
RStudio:
library(rUM)
rUM
into an existing folder/directory that does not
have an RStudio project.What if you have already created a folder containing the important
files for your project? Create a new project in your existing folder!
This will now be your project directory (complete with a
.Rproj
file).
Navigate to File > New Project > Existing Directory
Specify the location of where your research project will be saved
Run the following script in your console:
# Change the text inside the quotes on the next line to indicate the path to your folder/directory.
<- "~/Documents/blah"
PATH
make_project(PATH, type = "R Markdown (analysis.Rmd)")
rUM
has been servedA new project directory has been created and it will be populated with these files:
.gitignore
to help prevent the unintended
sharing of sensitive study information or protected health information
(PHI).analysis.Rmd
is a
Markdown template for writing your research project. It has a
preconfigured YAML header; Introduction, Methods, Results, Conclusion,
and Reference sections; and a code chunk to construct your bibliography
using knitr::write_bib()
.data
. This folder is listed
within the .gitignore
. That means that git should not track
these files. This should help prevent data leakage but be sure to talk
to a data security expert before sharing any biomedical projects on
websites like GitHub..Rproj
file with the same name as your project
folder.packages.bib
and
references.bib
, which are used to hold details for your
paper’s bibliography. Refer to the Methods and References sections,
respectively, within the analysis.Rmd
file for
initial examples of how to add/use references.the-new-england-journal-of-medicine.csl
is the citation style language (CSL) based on the New
England Journal of Medicine requirements.Newly created files:
analysis.Rmd
:
rUM
infused Markdown headersNavigate to File > New File > R Markdown
Select From Template
Choose a template:
This will create a new subdirectory in your current working directory
with the same name as the name of the .Rmd
file you
specified. Within this directory, you will find the
analysis.Rmd
R Markdown file. For example, if you created
an R Markdown file called wrangle_cytometry_data.Rmd
with
the steps above, then your current directory will now have a
subdirectory called wrangle_cytometry_data/
which will
contain the file wrangle_cytometry_data.Rmd
and any
subsequent files from the knitting process (such as .PDF
,
.html
, or .docx
files created by knitting the
R Markdown document).
This is a basic web page
This is a basic web page with a table of contents
PDF report where table and figures don’t float to other pages. Many thanks to https://stackoverflow.com/questions/16626462/figure-position-in-markdown-when-converting-to-pdf-with-knitr-and-pandoc.
A bookdown website with a good table of contents for a book
If you are new to R, ignore this.
sessionInfo()
#> R version 4.2.0 (2022-04-22)
#> Platform: aarch64-apple-darwin20 (64-bit)
#> Running under: macOS Monterey 12.5
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] digest_0.6.29 R6_2.5.1 jsonlite_1.8.0 magrittr_2.0.3
#> [5] evaluate_0.16 stringi_1.7.8 cachem_1.0.6 rlang_1.0.4
#> [9] cli_3.3.0 rstudioapi_0.13 jquerylib_0.1.4 bslib_0.4.0
#> [13] rmarkdown_2.14 tools_4.2.0 stringr_1.4.0 xfun_0.32
#> [17] yaml_2.3.5 fastmap_1.1.0 compiler_4.2.0 htmltools_0.5.3
#> [21] knitr_1.39 sass_0.4.2