Data Analytics Using R
Data Analytics Using R
Data Analytics Using R
Examples
2==3 | 3==3 # TRUE (if either is true then print TRUE)
2==3 & 3==3 # FALSE (another statement is FALSE, so ->FALSE)
Data Input
Data Types
Scalars
Matrices
Data Frames
Lists
Vectors
All columns in a matrix must have the same mode(numeric, character, etc.) and the same length.
char_vector_colnames))
byrow=TRUE indicates that the matrix should be filled by rows. byrow=FALSE indicates that the
matrix should be filled by columns (the default). dimnames provides optional labels for the
# another example
cells <- c(1,26,24,68)
rnames <- c("R1", "R2")
cnames <- c("C1", "C2")
mymatrix <- matrix(cells, nrow=2, ncol=2, byrow=TRUE, dimnames=list(rnames,
cnames))
d <- c(1,2,3,4)
f <- c(TRUE,TRUE,TRUE,FALSE)
v <- c(list1,list2)
Lists
• Discrete
• Continuous.