Hi. I created a matrix function with a for loop by using my R Markdown. It worked just fine if I run the chunk, however, when I knit the file, I received the following error message:
Error in Matrix(0, N, 1) : could not find function "Matrix"
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted
Here is the code which has error:
N = 717
p = 2
date1 = 1:N
Y = Matrix(0,N,1)
for (i in 1:N){
Y[i]=gas[i,4]
}
Can anyone give me some hints? Thank you in advance!