Rstan in Rstudio compile errors

I’m using the code below Rtools is install but I noticed when i go to this directory i don’t have Rcpp.h:27 but I do have Rcpp.h. Its like this on all the files. Please help. Thanks

pkgbuild::has_build_tools(debug = TRUE)


values = list(y = rnorm(1000,5,3)) 

model =" 

data { 
real y[1000]; 

parameters { 
real mu; 
real sigma; 

model { 
mu    ~ normal(0,10);   
sigma ~ normal(0,10);  
y     ~ normal(mu,sigma); 

fit <- stan(model_code = model, data = values, warmup = 500, iter = 1000, chains = 4, cores = 2, thin = 1) 
posterior = extract(fit) 

I keep getting this error message

Error in compileCode(f, code, language = language, verbose = verbose) :
In file included from C:/Users/thean/AppData/Local/Temp/Rtmp0kEsrn/downloaded_packages/, from C:/Users/thean/AppData/Local/Temp/Rtmp0kEsrn/downloaded_packages/, from file25c07a3a6abc.cpp:7:C:/Users/thean/AppData/Local/Temp/Rtmp0kEsrn/downloaded_packages/ fatal error: R.h: No such file or directory #include <R.h> ^~~~~compilation terminated.make: *** [C:/PROGRA~1/R/R-40~1.1/etc/x64/Makeconf:229: file25c07a3a6abc.o] Error 1
If you need to use math formula, use Latex syntax:

There shouldn’t be any rJava involved with compiling a Stan program and I don’t install rJava on my computers regardless of whether I use Stan. Do you have something weird in ~/.Rprofile ?

I think that zip downloaded with rtools

That looks like the name of the zip file. When I open the file all the Rcpp are there but they don’t have the extensions. For example RcppCommon.h:29 is just RcppCommon.h

when i use your work around remotes::install_github(“bgoodri/inline”) i get the error message. If i don’t use your work around I get the error message this is suppose to fix

You can install inline from CRAN now.