[1] 15
[1] 30
[1] 45
[1] 32
[1] 77
STA141A: Fundamentals of Statistical Data Science
<-
and =
. (The Tidyverse Style Guide prefers <-
and the Google R Style Guide is a fork of the Tidyverse’s. But most other programming languages use =
.)From a task-oriented perspective, using R and most other programming languages consists of:
You can think of:
We will talk about functions later on in detail, but we’ll start making use of functions straight away. Here it is useful to review some basic concepts.
Basic data types:
235.22
)1
)"You are here"
)TRUE
, FALSE
)NA
)Use class()
to get data type of a value
You can inspect data by entering the variable name into the console, or by using str()
What is the difference between
x
and y
?str(x)
and str(y)
?NA
.NA
becomes an NA
.NAs
.[1] 2 4 3 NaN
[1] 3 5 4 NaN
[1] NaN
[1] 3