Re: [R] sink() and source()

2007-07-05 Thread Duncan Murdoch
On 7/5/2007 11:35 AM, elyakhlifi mustapha wrote:
 > hello,
 > I have  a problem running a R script actually I'm using source() and 
sink() and it doesn't work
 >
 > source("T:/agents/melyakhlifi/R/essai_rep.r")
 >
 > to execute a file and the file contain
 >
 > sink("T:/agents/melyakhlifi/R/sortie.html")
 > cat("\n")
 > matrix.merge2
 > cat("\n")
 > sink()
 >
 >
 > I don't understand why when I execute just the syntax with sink() it 
work but in using source() it doesn't work
 > thanks

You don't say what is going wrong, but I suspect your problem is that 
you're not printing matrix.merge2.  Listing a variable name on a line by 
itself only causes it to be printed when you're typing at the console, 
not when it's a line in a function or a line sourced from a file.  You 
need to call print() explicitly in those cases.

Duncan Murdoch

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


Re: [R] sink() and source()

2007-07-05 Thread Greg Snow
I don't know what is causing your problem,  But if you goal is to
produce html then you may want to look at the R2HTML package.  It may do
what you want without using sink.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> elyakhlifi mustapha
> Sent: Thursday, July 05, 2007 9:35 AM
> To: R-help@stat.math.ethz.ch
> Subject: [R] sink() and source()
> 
> hello,
> I have  a problem running a R script actually I'm using 
> source() and sink() and it doesn't work
> 
> source("T:/agents/melyakhlifi/R/essai_rep.r")
> 
> to execute a file and the file contain
> 
> sink("T:/agents/melyakhlifi/R/sortie.html")
> cat("\n")
> matrix.merge2
> cat("\n")
> sink()
> 
> 
> I don't understand why when I execute just the syntax with 
> sink() it work but in using source() it doesn't work thanks
> 
> 
>   
> __
> ___ 
> 
>   [[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.