Introduction To R
Introduction To R
to R
CHAPTER I. Course Overview and
Preliminary Steps
Learning objectives
Console - see
your code run
here
R Commands
• Assignments E.g.: x = 1, or x <- 1
• Functions E.g.: print(“Hello World”)
• Computations E.g.: 17 + 3 ; x + 5
• Mix E.g.: y = sqrt(16); y = 15 + 5
Careful, R is case sensitive: The variables ‘x’ and ‘X’ can coexist
in R environment and have different values.
Basic data types in R
Joined Tables
Column A Column B Column C
A1 B1 C2
A2 B1 C2
A3 B2 C1
A3 B2 C3
• Note: It is not like what the cbind() function does: cbind() fuses datasets by pasting
them one next to the other, regardless of what is in the data
Joins
• There are different types of joins :
Summary Tables
• Contingency tables: Use table(cat_var1,cat_var2)
(where cat_var1 and cat_var2 are categorical
variables) to obtain the observations count for
each combination of these variables’ levels.