Skip to content

Write a script

2 messages · zze-CHOQUET Denis stagiaire FTRD/DMI/SOP, houix@ircam.fr

#
Dear R users,
I would like to write a script to launch R commands from a Unix prompt but I
do not have any idea how to do it. Can someone bring me help please?
Thanks in advance
Denis Choquet
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
I use these basic scripts:
script.sh
---------
#!/bin/sh
R --no-save < script.R
---------

script.R
---------
exp1 <- read.table("exp1tot")
exp1 <- (30 - exp1)/30
tab <- read.table("numero_son")
exp <- cbind(tab,exp1)
write.table(exp,"try",sep=" ",eol="\n",row.names = FALSE,col.names=FALSE)
---------

and now:
[machine] ./script.sh

R : Copyright 2001, The R Development Core Team
Version 1.3.0  (2001-06-22)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.

R is a collaborative project with many contributors.
Type `contributors()' for more information.

Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.
[machine] 

It works
Olivier Houix
On Thu, Jul 19, 2001 at 05:05:43PM +0200, zze-CHOQUET Denis stagiaire FTRD/DMI/SOP wrote: