#1 numeric
x1 <- c(1.1, -1.1)
x1; is.numeric(x1); x1[1]+x1[2]
#2 integer
x2 <- as.integer(x1)
x2; is.integer(x2); x2[1]+x2[2]
#3 matrix
x3 <- matrix(1,nrow=3,ncol=3)
x3; is.matrix(x3)
#4 character
x4 <- as.character(x1)
x4; is.character(x4); x4[1]+x4[2]
#5 logical
x5 <- c(1 < 2, 1 == 2)
x5[1]; is.logical(x5[1])
x5[2]; is.logical(x5[2])
#6 complex
x6 <- c(1+2i)
x6; is.complex(x6)
#7 check of data type
class(x3)
#8 overwriting data
x8 <- c(1)
x8; class(x8)
x8 <- c("abc")
x8; class(x8)
#9 conversion of data type
x9 <- c(1)
x9; class(x9)
x9 <- as.character(x9)
x9; class(x9)
x9 <- as.numeric(x9)
x9; class(x9)
#10 factor
x10 <- c("B","A","A","C","B","C","C","B","A","A")
x10; class(x10)
x10 <- factor(x10)
x10; class(x10)
levels(x10)
table(x10)
