[R] sink with R-code

Eusebio Arenal Gutiérrez use at eio.uva.es
Fri Jun 23 09:52:15 CEST 2000


Is there a funtion simlar to "sink" that redirect also R code to a file that
is:

sink("R001")
x <- c(2,-6,-4,8,5,4,1,3,4,-9,0,1)
A <- matrix(x, ncol=3)
A
A.prima <- t(A)
A.prima
dim(A)
dim(A.prima)
sink()

create a file "R001" with contents:

------------------------------------------
     [,1] [,2] [,3]
[1,]    2    5    4
[2,]   -6    4   -9
[3,]   -4    1    0
[4,]    8    3    1
     [,1] [,2] [,3] [,4]
[1,]    2   -6   -4    8
[2,]    5    4    1    3
[3,]    4   -9    0    1
[1] 4 3
[1] 3 4

--------------------------------------------

and what I want is a file with:

--------------------------------------------
> x <- c(2,-6,-4,8,5,4,1,3,4,-9,0,1)
> A <- matrix(x, ncol=3)
> A
     [,1] [,2] [,3]
[1,]    2    5    4
[2,]   -6    4   -9
[3,]   -4    1    0
[4,]    8    3    1
> A.prima <- t(A)
> A.prima
     [,1] [,2] [,3] [,4]
[1,]    2   -6   -4    8
[2,]    5    4    1    3
[3,]    4   -9    0    1
----------------------------------------------
Any hint will be appreciated

Eusebio


*************************************************************
*                 Eusebio Arenal Gutiérrez                  *
*   Departamento de Estadística e Investigación Operativa   *
*      _\|/_      Universidad de Valladolid                 *
*      (o o)               España                           *
*---oOO-(_)-OOo-----------------------------------,,,-------*
*                      use at eio.uva.es            (o o)      *
*---------------------------------------------oOO-(_)-OOo---*
*                 Eusebio Arenal Gutiérrez                  *
*     Department of Statistics and Operational Research     *
*                 University of Valladolid                  *
*                           Spain                           *
*************************************************************

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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