Displaying 1 result from an estimated 1 matches for "extractedvector3x1".
Did you mean:
extractedvector1x3
2006 Jul 27
2
Vector extracted from a matrix. How can I specify dimensions in as.matrix?
...L) and as.matrix can't
specify the number of row and columns so both vectors are vertical.
In this example, I extract a column and a row. Notice that both
as.matrix(vector) have the same dimension. Notice that both transposed
vectors have 1x3 dimensions.
initialmatrix <- matrix(1:9,3,3)
extractedvector3x1 <-initialmatrix[,1] # extract first columm as vector
extractedvector1x3 <-initialmatrix[1,] # extract first row as vector
#Both are NULL
dim(extractedvector3x1) #NULL!!!!
dim(extractedvector1x3) #NULL!!!!
#transposed dimensions both 1x3
dim(t(extractedvector3x1)) #1x3
dim(t(extractedvecto...