I am unable to understand the topic i.e. “Creating a Matrix Restructuring a Vector” in data analyst in R course.
Here is the link for your reference : https://app.dataquest.io/m/503/matrices-in-r/1/creating-a-matrix-restructuring-a-vector
So what I did not understand is : Why are we using
byrowparameter in matrices and what is its significance? and how to use it in scripting part.
Also, here is the example of logical matrix that is mentioned as, : A
logicalmatrix that decides which classes are validated or not for two students (each row represents a student):
is_validated <- c(TRUE, FALSE, FALSE, TRUE, TRUE, TRUE) mat_is_validated <- matrix(is_validated, nrow = 2) #notice that we only specify nrow here, we also use a vector variable
Now, here in the above programming it is stated that there are two rows but no columns were written and its output is given as:
_ [,1] [,2] [,3] [1,] TRUE FALSE TRUE 2,] FALSE TRUE TRUE
Instead, according to my understanding, it should be like
_ 1 2 3  TRUE FALSE FALSE  TRUE TRUE TRUE
Isn’t that right or if I am mistaken Please help me with this topic, Really got confused about it.
Please explain it in easy and laymen terms with easy examples.