# >
Data types
Creating objects
First, let’s create some objects:
aa <- 3; bb <- 3L; cc <- "3"; dd <- "TRUE"; ee <- TRUE; ff <- "NA"; gg <- NA
Checking data types
Guess what data type each object is then check it.
# >
How do we test if aa
is an integer?
# >
What will is.logical(dd)
return?
# >
How do we test if ff
and gg
are NA
?
# >
Checking if objects are the same
Are aa
and bb
the same? How do we test this?
# >
What about aa
and cc
?
# >
A safer comparison tool is identical()
. Test if aa
and bb
are identical. Then try aa
and cc
.
# >
Now see if aa
is identical to 3
and if bb
is identical to 3L
.
# >