Re: [R] sink with R-code

2007-03-08 Thread Bojanowski, M.J. \(Michal\)
Hi,

How about 'capture.output'? 
You could also put the code in a separate file and sink the sourcing it
with the echo=TRUE argument, for example (input.r contains the
commands).

sink("output.txt")
source("input.r", echo=TRUE)
sink()

HTH,

Michal 



*** Note that my e-mail address has changed to [EMAIL PROTECTED]
*** Please update you address books accordingly. Thank you!

_
Michal Bojanowski
ICS / Sociology
Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
Room 1428
[EMAIL PROTECTED]
http://www.fss.uu.nl/soc/bojanowski
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cooley, Scott K
Sent: Thursday, March 08, 2007 1:37 AM
To: r-help@stat.math.ethz.ch
Subject: [R] sink with R-code

I have the same question that Eusebio had:

Is there a function similar 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,]254
[2,]   -64   -9
[3,]   -410
[4,]831
 [,1] [,2] [,3] [,4]
[1,]2   -6   -48
[2,]5413
[3,]4   -901
[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,]254
[2,]   -64   -9
[3,]   -410
[4,]831
> A.prima <- t(A)
> A.prima
 [,1] [,2] [,3] [,4]
[1,]2   -6   -48
[2,]5413
[3,]4   -901
--
Any hint will be appreciated

Eusebio


Scott K. Cooley
Statistical Sciences, K6-08
Battelle--Pacific Northwest Division
Pacific Northwest National Laboratory
P.O. Box 999
Richland, WA  99352
Phone: 509-375-3604
FAX: 509-375-2604
Email: [EMAIL PROTECTED] 



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] sink with R-code

2007-03-07 Thread Cooley, Scott K
I have the same question that Eusebio had:

Is there a function similar 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,]254
[2,]   -64   -9
[3,]   -410
[4,]831
 [,1] [,2] [,3] [,4]
[1,]2   -6   -48
[2,]5413
[3,]4   -901
[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,]254
[2,]   -64   -9
[3,]   -410
[4,]831
> A.prima <- t(A)
> A.prima
 [,1] [,2] [,3] [,4]
[1,]2   -6   -48
[2,]5413
[3,]4   -901
--
Any hint will be appreciated

Eusebio


Scott K. Cooley
Statistical Sciences, K6-08
Battelle--Pacific Northwest Division
Pacific Northwest National Laboratory
P.O. Box 999
Richland, WA  99352
Phone: 509-375-3604
FAX: 509-375-2604
Email: [EMAIL PROTECTED] 



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.