Please watch the tutorial videos below on how to install R and RStudio.
So, R is a free software for statistical computing and graphics. But, what is RStudio and why is it recommended? Your answers in the end of this semester will probably include some of the reasons given in this article, Top 6 Reasons You Need to be Using RStudio.
The largest subpanel on the left is the
The buttons on the top right corner of each subpanel allow us to minimize, maximize, or resize the particular subpanel. We will learn about the other subpanels as we move along.
We can either use the R console in the R interface or in the RStudio interface. For now, the choice does not make any difference. But, when task gets more complicated, the advantage of using RStudio will be clear.
3 * 7
15 / 5
9 ^ 2
sqrt(36)age <- c(34, 82, 71, 36, 68)We deposited the data in the variable age. This was done
in two steps.
<-) deposited the content on the
right-hand side of the arrow (i.e., the ages) to the R variable
on the left-hand side of the arrow (i.e., the variable
age).Now if we type age in the console, then its content is
printed.
ageOf course, it is not practical to input larger dataset manually. Instead, we can read a large dataset from a file. For example
df <- read.csv("https://albums.yuanting.lu/sta126/data/credit.csv")The line reads the dataset from the file credit.csv and
saves it in the R variable df, so that from now
on, whenever we type df, R pulls out this saved
dataset. Let’s try it.
df