3
I would like to use a . bat file to run a particular file. r daily with windows taskmanager, but I’m not getting it running.
My steps are as follows: 1) open Notepad
2) enter code, which is currently:
"C:\Program Files\R\R-3.3.0\bin\i386\Rscript.exe" --vanilla "G:\Macroeconomia\Economistas\Coleta\Prohort\Prohort.R"
3) save the file in format . bat
4) two clicks to rotate it
However the bat does not run whole, it only loads the packets of my code and closes.
What do you mean "it only loads the packets of my code and closes"?
– Ismael
The beginning of my R code is a function that loads all the packages needed to run the code, so when I run the bat, you can see "loading Packages", then it closes
– Danilo Imbimbo
If it closes, it is because it finished the execution. Put a
pause
at the bottom of your.– David
but it is not running until the end, so much so that the files it generates are not being updated
– Danilo Imbimbo
By default, Windows closes the terminal when some script finishes running. I recommend entering the terminal, navigating to where the file
Prohort.R
is (i.e., the specific directory inside the drive G:) and runs"C:\Program Files\R\R-3.3.0\bin\i386\Rscript.exe" CMD BATCH Prohort.R
. This will generate a fileProhort.Rout
and inside it will be the log of R. There it will be possible to see what went wrong in your script. That is, find out why.– Marcus Nunes