Problems getting STAN to run on windows 10

Hello,

I am trying to install stan on my windows computer. I am using the following guidelines:

I have followed each step and each time I run the example code to test whether it is working, it continues to redownload the tools package. Any guidance in addressing this problem would be greatly appreciated.

Thank you in advance!

Sam

Here is the error message I am getting:

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:/Users/coyles/Documents/.R/Makevars.win:1: *** missing separator. Stop.

print(fit)
Error in print(fit) : object ‘fit’ not found

This file got messed up somehow. What is the output of

writeLines(readLines("~/.R/Makevars.win"))

?

Thanks for your response. Here is the output :

writeLines(readLines("~/.R/Makevars.win"))
library(“rstan”) # observe startup messages

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -march=native

CXX14FLAGS=-O3 -march=native
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -march=native

CXX14FLAGS=-O3 -march=native
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -march=native

You certainly don’t need all those lines several times. I would try

file.remove("~/.R/Makevars.win")

and then

install.packages("https://win-builder.r-project.org/9lJAt18Tb6mf/StanHeaders_2.18.1-10.zip", repos = NULL)
install.packages("https://win-builder.r-project.org/OP272u474CMQ/rstan_2.19.1.zip", repos = NULL)

Thank you so much for your help! This code worked and I was able to run it. Greatly appreciate your assistance!