Data structures
Create & delete variables
Create & delete variables
# create a variable
x=5
# show (list) all variables
ls()
"x"
# delete a variable
rm(x)
# delete all variables in R (clear, clean up)
rm(list=ls())
Check data type of a variable
Check data type of a variable
x = 5
typeof(x)
"double"
class(x)
"numeric"
y = data.frame("A" = c(12,52,14), "B" = c(81,32,65))
typeof(y)
"list"
class(y)
"data.frame"
z = as.matrix(y)
class(z)
"matrix"
Read more
Read more