Difference between revisions of "Batch Files - Hilary Dugan"
From Gleon Fellowship
(Set PropertyValue: Type = low) |
(Added PropertyValue: Expertise = r programming) |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Task]] | [[Category:Task]] | ||
+ | ==Skills Sharing: Batch files to graph with R== | ||
+ | |||
+ | Why should I use a batch file? | ||
+ | * Any R script can be run without opening R | ||
+ | * Can output figures | ||
+ | * Can be automated to run daily | ||
+ | |||
+ | Challenges: | ||
+ | * Batch files run natively on Windows OS | ||
+ | |||
+ | |||
+ | Example on Windows 7: | ||
+ | Two files are needed | ||
+ | # The R script (ex. helloworld.R) | ||
+ | # The batch file should be saved as "NAME.bat". It will be a text file that contains the following code (substitute path directories where necessary). | ||
+ | <code>"C:\Program Files\R\R-2.15.2\bin\x64\R.exe" CMD BATCH "D:\user\...\helloworld.r" "D:\...\helloworld.out” | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
<!-- Add any wiki Text above this Line --> | <!-- Add any wiki Text above this Line --> | ||
<!-- Do NOT Edit below this Line --> | <!-- Do NOT Edit below this Line --> | ||
− | {{#set:| | + | {{#set: |
+ | Expertise=R_programming| | ||
+ | Owner=Hilary| | ||
+ | Progress=100| | ||
+ | StartDate=2015-01-19| | ||
+ | TargetDate=2015-01-23| | ||
Type=Low}} | Type=Low}} |
Latest revision as of 20:17, 21 January 2015
Skills Sharing: Batch files to graph with R
Why should I use a batch file?
- Any R script can be run without opening R
- Can output figures
- Can be automated to run daily
Challenges:
- Batch files run natively on Windows OS
Example on Windows 7:
Two files are needed
- The R script (ex. helloworld.R)
- The batch file should be saved as "NAME.bat". It will be a text file that contains the following code (substitute path directories where necessary).
"C:\Program Files\R\R-2.15.2\bin\x64\R.exe" CMD BATCH "D:\user\...\helloworld.r" "D:\...\helloworld.out”