[R] Write a script

houix@ircam.fr houix at ircam.fr
Fri Jul 20 12:02:59 CEST 2001


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.

> 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)
> 
[machine] 

It works
Olivier Houix 

On Thu, Jul 19, 2001 at 05:05:43PM +0200, zze-CHOQUET Denis stagiaire FTRD/DMI/SOP wrote:
> From: zze-CHOQUET Denis stagiaire FTRD/DMI/SOP <denis.choquet at rd.francetelecom.com>
> To: "'r-help at lists.R-project.org'" <r-help at lists.R-project.org>
> Subject: [R] Write a script
> Date: Thu, 19 Jul 2001 17:05:43 +0200
> 
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-- 
Olivier Houix  <houix at ircam.fr>             tel: 01 44 78 15 51
Equipe Perception et Cognition Musicales    http://www.ircam.fr/pcm/houix/  
IRCAM   1 place Igor Stravinsky             75004         Paris           
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list