This is a collection of R things from your friends at UM (The University of Miami).
A research project template. It creates a new RStudio project that has your choice of an
analysis.qmd Quarto file or
analysis.Rmd R markdown file with tidyverse and conflicted.
Quarto and R Markdown templates which include they YAML header and start up blocks that load the tidyverse and conflicted packages.
💥 NEW in Version 1.0.2 💥 We cleaned (i.e., linted and styled) the code and fixed a couple small formatting issues in the paper templates. The automatically produced paper code should pass checks based on the tidyverse style guide.
Modern versions of the RStudio interface (v2022.07 or later) ships with Quarto; update to the most recent version of RStudio here. If you know what you are doing, you can install the latest version of Quarto directly from here.
Then you should run this in the console of RStudio:
If you would like the (unstable) development version, use the following code instead:
The default reference style is the New England Journal of Medicine. The style is set by the Citation Style Language (
csl:) option near the top of the file. To use a different style, download a csl file from https://www.zotero.org/styles/ into the folder with your analysis file. Then change the-new-england-journal-of-medicine.csl to the name of the file you downloaded.
The analysis file includes this code near the bottom:
c( .packages(), "rUM", "table1" ),
If you want to acknowledge a package that is not used directly in your analysis file, add its name inside of the
c() function. The authors of the packages that you used for exploratory data analysis will thank you.
After you knit/render the analysis file once the packages will appear in the “packages.bib” file in the same directory/folder as your analysis file. If you are using the RStudio Visual Editor, put the cursor when you want to add the citation, then use the Insert Menu and choose @ Citation… and pick the article. If you are using the Visual Studio Source Editor, open the “packages.bib” file, find the manual reference for the package that you want to add and copy it. For example, if you needed to add a reference to the
rUM package you would find this line:
and copy the reference name. Here the name is
R-rUM. Paste that where you want the citation like this
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 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
.docx files created by knitting the RMarkdown document).
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