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("<html><body><pre>\n") matrix.merge2 cat("</pre></body></html>\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]]
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 greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of > elyakhlifi mustapha > Sent: Thursday, July 05, 2007 9:35 AM > To: R-help at 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("<html><body><pre>\n") > matrix.merge2 > cat("</pre></body></html>\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 at stat.math.ethz.ch mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
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("<html><body><pre>\n") > matrix.merge2 > cat("</pre></body></html>\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