Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running R in batch-mode - print to screen?

Tags:

r

When running

R CMD BATCH [options] filename.r

I want to control where the output is printed. I can suppress the creation of the .Rout file with

R CMD BATCH [options] filename.r /dev/null

but is it possible to direct the output to the screen? Like when I run it by

R [options] < filename.r

?

like image 285
hatmatrix Avatar asked Aug 28 '10 23:08

hatmatrix


2 Answers

Guess you're on linux. Tried already to redirect to /dev/console ?

Edit -add info from the comments -:

/dev/console apparently doesn't work, /dev/tty does. Depending on the system, /dev/tty0 might be an option too

Cheers

like image 100
Joris Meys Avatar answered Sep 30 '22 04:09

Joris Meys


Try Rscript or R --no-save < filename.R:

biocoreap1:Desktop vinceb$ Rscript test.R
test
biocoreap1:Desktop vinceb$ R --no-save < test.R

R version 2.10.1 (2009-12-14)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

[...]

[Previously saved workspace restored]

> cat('test\n')
test
> 
like image 31
Vince Avatar answered Sep 30 '22 02:09

Vince