Homework1 Importing data from statistical package and from database
management system.
library(readxl)
My_data <- read_excel("My_data.xlsx")
View(My_data)
Homework2 Frame matrix and array
vector: The foundational R data structure
Logical
X <- c(TRUE, FALSE)
x <- c(T, F)
Character
X <- c("a", "b", "c")
Complex
X <- c(1+0i, 2+4i)
Matrix and operation within matrices
X <- matrix(1:6, nrow = 2, ncol = 3)
X
## [,1] [,2] [,3]
## [1,] 1 3 5
## [2,] 2 4 6
Y <- matrix(1:6, nrow = 3, ncol = 2)
Y
## [,1] [,2]
## [1,] 1 4
## [2,] 2 5
## [3,] 3 6
List
X <- list(1, "a", TRUE, 1+4i)
x
## [1] TRUE FALSE
Factor
X <- factor(c("yes", "yes", "no", "yes", "no"))