cat("Hello, R!")
Hello, R!
Welcome to this course on data analysis using R! This course is aimed at the intermediate R developer who wants to learn how to do useful data analysis tasks in R. It will focus on “modern R”, specifically using the tidyverse collection of packages which are designed for data science.
For the purpose of this course we will be using RStudio which provides you with a text editor and R console. Setting up instructions can be found here.
By the end of this course, you will:
tydiverse
ecosystemIn this documentation, any time that we are seeing a small snippet of R code, we’ll see it written in a grey box like the following:
cat("Hello, R")
If the commands are executed by the machine we will see the output of them below enclosed on a vertical purple line:
cat("Hello, R!")
Hello, R!
By contrast, you will see larger pices of code as scripts with a given name, e.g. script.R
, in a code block with darker header:
script.R
<- "Jean Golding"
name cat("Hello,", name, "!")
We may ask you to run a script using the Command Prompt
(Windows) or Terminal
(Mac and Linux). We will show you what commands to run and will look like this:
Terminal/Command Prompt
Rscript script.R
In some cases we will introduce general programming concepts and structures using pseudocode, a high-level, easy-to-read syntax close to natural language. This should not be confused with R code and cannot be executed on your machine, but it is useful to describe how your code should behave. Here there is an example:
FOR EACH sample IN my_study
IF (sample.value > 100)
DO SOMETHING
OTHERWISE
DO SOMETHING ELSE
There are some exercices along this course, and it is important you try to answer them yourself to understand how R works. Exercises are shown in blue boxes followed by a yellow box that contains the answer of each exercise. We recommend you to try to answer each exercise yourself before looking at the solution.
Last, we will highlight important points using green boxes like this one: