Comments inline:
Stefano Sofia wrote:
Dear Splus users,
I do need some advices about vectors definition and storage.
I am building a quite big procedure where many vectors and matrices are
involved. Within this procedure there is a for loop (of length n),
and because of at each step I want to store all the vectors and matrices, I
use the following structure:
array(NA, dim = c(n, number of rows, 1)) or array(NA, dim = c(number of rows,
1)) for the vectors and
array(NA, dim = c(n, number of rows, number of columns)) or array(NA, dim =
c(number of rows, number of columns)) for the matrices.
For some reasons it happens that vectors are stored not correctly:
not vertically (for example of dimension 13 by 1)
but horizontally (i.e. of dimension 1 by 13).
In the function below reported, the vector E4iniz is correctly evaluated
(dimension (14 by 1), but with
E6iniz <- E4iniz[(2:14), ]
E6iniz <- E4iniz[(2:14), ,drop=F ]
# drop=T, the default, reduces the dimension of the array
I hope this solves the problem without me reading the rest of your code.
Best Wishes,
spencer graves
<snip>
|