name_of_object <- the_function_I_want_to_use()Introduction to R, RStudio and Quarto

Overview
R is a free software environment for statistical computing and graphics. It is what’s known as ‘open source’, which means that unlike commercial software companies that protectively hide away the code on which their software is based, the people who developed R allow everyone to access their code. This open source philosophy allows anyone, anywhere to contribute to the software. Consequently, the capabilities of R dynamically expand as people from all over the world add to it. In essence, R exists as a base package with a reasonable amount of functionality. Once you have downloaded R and installed it on your own computer, you can start doing some data analysis and graphs. However, the beauty of R is that it can be expanded by downloading packages that add specific functionality to the program. Commands in R are generally made up of two parts: objects and functions. These are separated by <-, which you can think of meaning ‘is created from’. As such, the general form of a command is:
Which means the object called name_of_object is created from the function that goes by the name of the_function_I_want_to_use. An object is anything created in R. It could be a variable, a collection of variables, a statistical model etc. Objects can be single values (such as the mean of a set of scores) or collections of information; for example, when you run an analysis, you create an object that contains the output of that analysis, which means that this object contains many different values and variables. Functions are the things that you do in R to create your objects.
The best way to learn R (in my opinion) is to install and work through one my packages of interactive tutorials. The adventr package aligns to the material in An Adventure in Statistics whereas the discovr package aligns to the material in Discovering Statistics Using R and RStudio. If you don’t own either of these books use the discovr package.
Interactive tutorials to learn R
Video tutorials
Getting Started in R
To help you set up and work with R I recommend working through these video tutorials, which introduce you to the workflow in RStudio cloud, and give you a tour of the RStudio app.
Setting up R and RStudio
This video shows how to set up R and RStudio on your own computer
This video shows how to set up R and RStudio on Posit Cloud
Workflow in Posit (RStudio) Cloud
Customizing RStudio cloud
Quarto
Quarto is used to create documents in RStudio. It combines standard word processing (similar to apps that you might already use such as MS Word) with coding to produce documents in which you integrate data processing, data visualisation, statistical modelling and interpretation. This series of videos helps you to get started using Quarto.
Quarto visual editor [Part 1]
Quarto visual editor [Part 2]
Quarto visual editor [Part 3]
Quarto visual editor [Part 4]
Quarto visual editor [Part 5]
LaTeX equations
Interacting with R
This series of videos looks at the basic principles of writing code in R and how to integrate R code into a Quarto document.
What is … an R package?
This tutorial explains what functions and packages are and how to install packages within R.
What is … is a function?
This tutorial explains what a function is and demonstrates using an example in R.
Creating stuff using R
This tutorial explains how to create objects in R using the assignment operator. The second example looks at storing some data, which leads us into describing dataframes/tibbles and how to access variables within them.
Using functions and the pipe operator
This tutorial explores how to use functions in R with the pipe operator. We use spotify metrics for every song by the band Iron Maiden to show how to select variables in a data frame and how to include only cases that meet a specific condition. We use the tidyverse functions select() and filter() to achieve this before looking at how to combine these functions using the pipe operator.
Getting data into R
This tutorial explores how to use the here() and read_csv() functions to import a CSV (comma separated value file) file in R. This tutorial explains some code that is used extensively in other tutorials.
Creating variables using mutate()
This tutorial explores how to use the mutate() function in R to create new variables in your data frame. We use spotify metrics for every song by the band Iron Maiden to show how to create new variables from existing ones. We convert the song durations from milliseconds to seconds, and convert the year each album was released into a variable representing the years since the first album was released.
Fitting statistical models: a general process
The process of E.V.I.L is a framework that applies to any statistical model you fit and reminds you of the key steps in the model fitting process. This tutorial shows how I used R to implement this framework to test my prediction that my favourite band, Iron Maiden, write longer songs as they get further into their career. It shows how the tables and plots in the other video were generated using the easystats package.