00-Hello

Ottavia M. Epifania

Course material


All course material is available on GitHub:


https://ottaviae.github.io/quarto-school/

Quarto

What is it?


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/

R Markdown

markdown is a markup languange: Programming language where formatting is handled by chunk codes, tags


markdown: .md

R Markdown: .Rmd

quarto: .qmd

markup languages

HTML editor

LaTex Editor

WYSIWYG languages

What You See Is What You Get

The text is modified with built-in command, you can see immediately the changes:

Why?

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

An example

But you are asked to change the ggplot theme!

Using a WYSIWYG:

  1. Re-open R

  2. Find the data again

  3. Re-run the analysis

  4. Plot the results with the requested changes

  5. Save the plot

  6. Import the plot in the document

Here.. just add + theme_light() to the code

Plus, can be interactive:

Let’s get started 🥳

Be tidy: Rstudio Project

Create 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?

GitHub (also know as “Nerdstagram”)

https://github.com/

It is needed to create sharable html documents

It allows to share your code (and your projects) with others

Create an account

Username and password

Please, choose something that you can remember


Solve the CAPTCHA and submit

GitHub Desktop

https://desktop.github.com/


Installare Git

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:

“Clone” an existing repository I

From GitHub desktop:

Add Local Repository \(\rightarrow\) search for the directory of the R project to publish on GitHub

“Clone” an existing repository II

Option: create a repository

Flag the option “Initialize the repository with a README

Did it work?

Navigate to you GitHub profile on https://github.com/ and to your repositories:

The repository must be public

Learn by doing

To explore the potentials of integrating code chunks, analyses, and results in one unique document, we need to work with a real dataset:

Download dataset from the course website

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

Your turn!

  1. Create a default R project for this course

  2. Create a GitHub account (and install Git and GitHub desktop)

  3. Add the project you have created for this course to your GitHub account

  4. Check whether the repository is available online and make it public


Final check: Download this file, open it in your newly created project and: