8.1 Checking data types
Number:
<- 10
a mode(a)
## [1] "numeric"
typeof(a)
## [1] "double"
str(a)
## num 10
Text:
<- "word"
b mode(b)
## [1] "character"
typeof(b)
## [1] "character"
str(b)
## chr "word"
HANDS-ON
- Create the following objects:
<- "R course"
o1 <- 10
o2 <- FALSE
o3 <- "9" o4
- Check the data type of each object with mode.
- Did you expect a different result? Why?