I know that when applying SVD on a matrix (m * n) I should have these three outputs:
S: m × n diagonal matrix with non negative numbers
U: m × m orthogonal matrix
V: n × n orthogonal matrix
but when using R statistical package. I got for S a vector instead of a matrix:
look please:
and after applying the SVD, i got these:
notice that S (the first result) is a vector of (1 * 6), while it should be from size ( 6 * 6)
what's going on please?
The notation
$$S = \text{diag}(\lambda_1, \lambda_2, \ldots, \lambda_N)$$
defines the symmetric matrix
$$ S = \begin{bmatrix} \lambda_1 & 0 & \ldots & 0\\ 0 & \lambda_2 & \ldots & 0\\ \vdots & \vdots & \vdots & \vdots\\ 0 & 0 & \ldots & \lambda_N\\ \end{bmatrix} $$
Other notation than can helps to understand the situation is
$$d = \text{diag}(S)$$
which defines a vector with the elements in the main diagonal of $S$
$$ d = \begin{bmatrix} \lambda_1\\ \lambda_2\\ \vdots\\ \lambda_N\\ \end{bmatrix} $$
EDIT: The svd function gives you a vector of length $\text{min}(n,m)$ with the singular values of the matrix. In your case $n=6$ and $m=5$, therefore the length of the vector is $5$. As you said, the matrix $S$ is $6\times 5$, therefore in this case $S$ would have zeros everywhere except at the first $5$ elements in the main diagonal. That is, the last row of $S$ is all zeros. Although the above notation is not being used strictly, it could help to understand why a vector and not a matrix, which was your original question.
EDIT2: I change my wording in my firs edit in response to Mike's comment. $\text{min}(n,m)$ is the length of the vector $p$ that is returned by the svd function, which is the number of singular values that an $n\times m$ matrix can have, and some of them can be zero. I guess that if the rank $r$ of the matrix is less than $\text{min}(n,m)$, the function would return $\text{min}(n,m)-r$ singular values equal to zero in the vector. I could test this maybe later.
EDIT3: Here an example where the rank $r$ of the matrix is $3$ but $\text{min}(4,5) = 4$.
$\hspace{3cm}$
The svd function returns a vector of lenght $4$, with $3$ non-zero singular values and one singular value equal to $0$.