R construction with Matrix dimension in plane and mathematical combinatoric explain
structure of matrix operation in R programming language
A1 = matrix(
c(1, 2, 3, 4, 5, 6), # the data elements
nrow=2, # number of rows
ncol=3, # number of columns
byrow = TRUE) # fill matrix by rows
the output of Variable A is show as
the dimension size of A is 2x3
the a11 is look at [1,] and [,1] at the same time
A2 = matrix(c(1, 2, 3, 4, 5, 6), 2, 3,by row = T)
is alternate way to construct of result as matrix A that can summary as “nrow = ” and “ncol = ” can be omit in the construction of matrix syntax order.
A3 = matrix(c(1:6), 2, 3,by row = T) and
A4 = matrix(1:6, 2, 3,by row = T)
the rusult is the same in first but in R collect variable A1, A2 as type “num” but A3,A4 is collect variable as type “int”
can check with R proof with command A1 == A2 the rusult is
result is the same as A2 == A3 and A3 == A4
In this stage we can conclude that A1 = A2 = A3 = A4
what happen with
B1 = matrix(c(1:6), 2, 3,by row = FALSE) the result is
is the same result with B2 = matrix(c(1:6), 2, 3,by row = F)
with omit the “nrow = ” and “ncol = ” syntax
what happen with remove by “by row = F”
like BN = matrix(c(1:6), 2, 3)
the result is still the same as B1,B2 be cause it default value syntax can be omitted it.
C = matrix(c(1:6),nrow=2)
D = matrix(c(1:6),ncol=3)
that can omit the one dimension C and D is array element in to specific row or column index with element in matrix long. in the principle way like the equation
number of elements / (number of row elements(number of column elements)
in combinatoric explain
can sumary as condition (byrow = F) and 6 elements and with sequential elementts is = 2*2*(3)+1+1+1 = 15 ways to construction.
as condition (byrow = T) and 6 elements and with sequential elements is = 2*2*(3)+1+1 = 14 ways to construction.