I get the following error messages: 1: In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="Tariffs.stan": The system cannot find the file specified
2: In file(fname, "rt") :
cannot open file 'C:\Users\prabu\OneDrive\Documents\Tariffs.stan': No such file or directory
Error in get_model_strcode(file, model_code) :
cannot open model file "C:\Users\prabu\OneDrive\Documents\Tariffs.stan" and I am attaching both the files. I am not sure why these errors happen, and I would appreciate if you let me know where I am going wrong. Thank you for the feedback.
The command you called (that you didn't give here) apparently expects a file called "Tariffs.stan" to be located at "C:\Users\prabu\OneDrive\Documents\Tariffs.stan". But the file is not there.
I see three possibilities:
-
if you use a script written by someone else with harcoded paths inside, you may have to change the paths to make it match your computer.
-
if you are working from a downloaded R script, but you didn't download the stan file. In that case you need to find the stan file and make sure it is along with your R script.
-
If you have the right file, but it is not found where expected. The easiest fix is to make sure the stan file is located at "C:\Users\prabu\OneDrive\Documents\Tariffs.stan" by copy-pasting it there.
The good practice is to have a project folder containing both your R script and stan file, then, in the R script, make sure you call the correct path, for example:
stan(file = "Tariffs.stan", data = mydata)
or
stan(file = file.path("my_sub_directory", "Tariffs.stan"), data = mydata)