Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
283 views
in Technique[技术] by (71.8m points)

Why (or when) is Rscript (or littler) better than R CMD BATCH?

I am automating some webscraping with R in cron and sometimes I use R CMD BATCH and sometimes I use Rscript.

To decide which one to use I mainly focus if I want the .Rout file or not.

But reading the answers to some questions here in SO (like this or this) it seems that Rscript is preferred to R CMD BATCH.

So my questions are:

  • Besides the fact that the syntax is a little different and R CMD BATCH saves an .Rout file while Rscript does not, what are the main differences between the two of them?

  • When should I prefer one over another? More specifically, in the cron job above mentioned, is one of them preferred?

  • I have not used yet littler, how is it different from both Rscript and R CMD BATCH?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From what I understand:

R CMD BATCH:

  • echo the input statements
  • can not output to stdout

Rscript:

  • does NOT echo
  • output to stdout
  • can be used in one-liner (i.e. with no input file)

littler:

  • all that Rscript does
  • can read commands from stdin (useful for pipelining)
  • faster startup time
  • load the methods package

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...