I am struggling to repeat a vector over a matrix. I have prepared a 200 by 100 matrix (ftmp) that I want to compare to a vector of 100 variables (occ). Essentially I am saying if the ith value in the vector occ is less than or equal to 0.8 then I want the corresponding ith row in the matrix ftmp to be changed to a vector of -999 repeated 100 times across the ith row. Does anyone have any suggestions for how to reformat this?
data{
matrix[200,100] ftmp;
vector[200] occ;
}
functions {
do.fxn()
for (i in 1:200) {
if(occ[i] <= 0.8){ ftmp[i,] = rep_array(-999, 100); }
.... function continues...
The error message is
"SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Dimension mismatch in assignment; variable name = ftmp, type = row_vector; right-hand side type = int[ ].
Illegal statement beginning with non-void expression parsed as
ftmp[i, :] "