Hello, I want to fill my matrix from array of vectors by appending or assinging them.
(the code is just to show the problem)
matrix[rowsN, factorsCount] allFactors;
from some source data
vector[rowsN] factors[factorsCount];
ways to do it could be:
for(i in 1:factorsCount)
{
allFactors[,i] =factors[i] ;
}
or may be I should declare empty matrix and then concatenate it with vectors...
matrix[rowsN, factorsCount] allFactors;
for(i in 1:factorsCount)
{
allFactors =append_col(allFactors, factors[i]) ;
}
Both approaches give error from the compiler:
"Not a legal assignment, sampling, or function statement. Note that
* Assignment statements only allow variables (with optional indexes) on the left;
if you see an outer function logical_lt (<) with negated (-) second argument,
it indicates an assignment statement A <- B with illegal left
side A parsed as expression (A < (-B))."
Which is the correct way to fill matrix from array of vectors?
Regards,
Nikolay