All course material is available on GitHub:
R Markdown, next generation
All based on knitr to execute R code
Analyze. Share. Reproduce. You have a story to tell with data—tell it with Quarto.
In this course: RStudio!
Download R: https://cran.r-project.org/bin/windows/base/
Download RStudio: https://posit.co/download/rstudio-desktop/
markdown
is a markup languange: Programming language where formatting is handled by chunk codes, tags
markdown
: .md
R Markdown
: .Rmd
quarto
: .qmd
What You See Is What You Get
The text is modified with built-in command, you can see immediately the changes:
Using knitr, it allows for integrating analyses, text, and graphs in a single document:
Replicability
Tydiness
Convenience
Create dynamic content with Python, R, Julia, and Observable
But you are asked to change the ggplot theme!
Using a WYSIWYG:
Re-open R
Find the data again
Re-run the analysis
Plot the results with the requested changes
Save the plot
Import the plot in the document
Here.. just add + theme_light()
to the code
Plus, can be interactive:
Rstudio
ProjectCreate a directory that can be re-organized in subdirectories, allowing for a conveninet managment of all the files (data, images, bibliography)
File \(\rightarrow\) New project:
What?
Where?
It is needed to create sharable html documents
It allows to share your code (and your projects) with others
Please, choose something that you can remember
Solve the CAPTCHA and submit
GitHub desktop allows for an “inderect” connection between RStudio and GitHub
Git allows for a direct connection between RStudio and GitHub
Just follow the default installation
If it worked:
From GitHub desktop:
Add Local Repository \(\rightarrow\) search for the directory of the R project to publish on GitHub
Option: create a repository
Flag the option “Initialize the repository with a README
Navigate to you GitHub profile on https://github.com/ and to your repositories:
To explore the potentials of integrating code chunks, analyses, and results in one unique document, we need to work with a real dataset:
Dataset details:
anxiety
: Anxiety score — higher scores indicate higher levels of anxiety
flexibility
: Cognitive flexibility score — higher scores indicate greater flexibility
mindfulness
: Whether the person practices mindfulness daily, no
vs. yes
activity
: Type of sport activity practiced, pilates, altro, yoga
Create a default R project for this course
Create a GitHub account (and install Git and GitHub desktop)
Add the project you have created for this course to your GitHub account
Check whether the repository is available online and make it public
Final check: Download this file, open it in your newly created project and:
Hello, my name is quarto