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