Introduction To R: # Creating A Vector of Numbers
Introduction To R: # Creating A Vector of Numbers
Introduction To R: # Creating A Vector of Numbers
Soumya Roy
# Creating a Vector of Numbers
x<-c(1,2,3,4)
x
## [1] 1 2 3 4
## [1] 1 2 3
y<-c(4,5,6)
y
## [1] 4 5 6
# Length of a Vector
length(x)
## [1] 3
length(y)
## [1] 3
## [1] 5 7 9
## [1] 2 4 6
c*y
## [1] 8 10 12
## [1] "c"
## [,1] [,2]
## [1,] 1 3
## [2,] 2 4
# Dimension of a Matrix
dim(X)
## [1] 2 2
# Inverse of Matrix
I<-solve(X)
## [1] 7
## [,1] [,2]
## [1,] 4 7
## [2,] 5 8
## [3,] 6 9
## [,1] [,2]
## [1,] 4 7
## [2,] 5 8
## [,1] [,2]
## [1,] 4 7
## [2,] 5 8
## [3,] 6 9