When entering this in the R console:
1 + 2
we get, as an answer:
[1] 3
Does the leading [1]
mean "The output is a matrix, and the elements in the first line of this matrix are: 3" ?
More generally, are these objects a vector, a list, a single-row matrix or a single-column matrix?
1 + 2
(i.e.3
, i.e. just a number)c(1,-2,3,14)
A = matrix(c(1,-2,3,14),2,2)
A[1,]
: this is the first line of the matrix. Is it a (1, 2) single-row matrix or just a vector or a list?A[,2]
: this is the second column of the matrix. Is it a (2, 1) single-column matrix or just a vector or a list?
I've already read the documentation a few times, but I was wondering if there exists a rule of thumb to remember this?