开发者

how to execute .r files in windows

Below is the code in a .r file. I want to execute this from a Windows command prompt, but how?

library(coda)
a <- read.coda("CODAchain1.txt","CODAindex.txt")
out <- cap开发者_JAVA技巧ture.output(summary(a)) 
cat(out,file="out.txt",sep="\n",append=FALSE) 


You can make a text file named coda_scrp.r and then at the command prompt type:

R CMD BATCH /<full-path>/coda_scrp.r

Jim Lemon is one of the R guru's that contribute on r-help. He does a lot of graphics stuff with base graphics and is a major contributor to the plotrix package. He also has a website for "Kickstarting R" and you can get more details about running R scripts here:

Here's a link to a well written set of instructions that show the differences in using R CMD BATCH and Rscript:

And here is an answer on SO showing how to use a .bat file: Start RScript without DOS box (on Windows)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜