Rmarkdown in Stan seems to be another headache inside of my life. When inputting this as a code chunk. I get an error
```{R, engine="stan",engine.opts=list(x="mod")}
data {
int N; //the number of observations
//int N2; //the size of the new_X matrix
int K; //the number of columns in the model matrix
real y[N]; //the response
matrix[N,K] X; //the model matrix
//matrix[N2,K] new_X; //the matrix for the predicted values
}
parameters {
vector[K] beta; //the regression parameters
real sigma; //the standard deviation
}
transformed parameters {
vector[N] linpred;
linpred <- X*beta;
}
model {
beta[1] ~ uniform(-10,10); //prior for the intercept following Gelman 2008
for(i in 2:K)
beta[i] ~ uniform(-10,10);//prior for the slopes following Gelman 2008
y ~ normal(linpred,sigma);
}
//generated quantities {
// vector[N2] y_pred;
// y_pred <- new_X*beta; //the y values predicted by the model
//}
```
the error is
Error in if (nchar(CXX) > 0) return(TRUE) : argument is of length zero
Calls: <Anonymous> ... engine -> assign -> do.call -> <Anonymous> -> find_rtools
In addition: Warning messages:
1: In engine(options) :
the option engine.opts$x is deprecated; use the chunk option output.var instead
2: running command '"C:/PROGRA~1/R/R-33~1.1/bin//R" CMD config CXX' had status 2
Execution halted
When using another method
ie ```{stan, output.var="ex1"}
data {
int N; //the number of observations
//int N2; //the size of the new_X matrix
int K; //the number of columns in the model matrix
real y[N]; //the response
matrix[N,K] X; //the model matrix
//matrix[N2,K] new_X; //the matrix for the predicted values
} .... and so on
I get a similar error
Quitting from lines 78-110 (main.Rmd)
Error in if (nchar(CXX) > 0) return(TRUE) : argument is of length zero
Calls: <Anonymous> ... engine -> assign -> do.call -> <Anonymous> -> find_rtools
In addition: Warning message:
running command '"C:/PROGRA~1/R/R-33~1.1/bin//R" CMD config CXX' had status 2
Execution halted
What does these error mean? Does it have to do with my Rtools?and How do I fix it?