Sklyar, Oleg (London)
2008-Aug-20 12:17 UTC
[Rd] showMethods("plot", printTo=FALSE) fails if printTo set to FALSE
Hi everybody, any idea why showMethods fails with the following error when printTo is set to false, i.e. to return the output as a character vector. It works fine if printTo is left default as seen below. The behaviour is consistent for any method I tried. stdin() generally works fine on this system, at least when checked with: x = readLines(). Thanks, Oleg> x = showMethods("plot", printTo=FALSE)Error in cat(file = printTo, sep = "", ...) : cannot switch output to stdin Enter a frame number, or 0 to exit 1: showMethods("plot", printTo = FALSE) 2: .showMethodsTable(fdef, includeDefs, inherited, classes = classes, showEmpt 3: doFun(f, p) 4: cf("Function: ", func, " (package ", pkg, ")\n") 5: cat(file = printTo, sep = "", ...) Selection: 0> x = showMethods("plot")Function: plot (package graphics) x="ANY", y="ANY" x="SimResults", y="SimResults" x="SimResults", y="missing" x="TimeDateBase", y="character" x="TimeDateBase", y="data.frameOrMatrix" x="TimeDateBase", y="missing" x="TimeSeries", y="missing"> sessionInfo()R version 2.8.0 Under development (unstable) (2008-08-05 r46234) x86_64-unknown-linux-gnu locale: C attached base packages: [1] datasets splines utils stats graphics grDevices methods [8] base other attached packages: ## 64bit RHEL 5 Dr Oleg Sklyar Technology Group Man Investments Ltd +44 (0)20 7144 3803 osklyar at maninvestments.com ********************************************************************** The contents of this email are for the named addressee(s...{{dropped:22}}
Prof Brian Ripley
2008-Aug-20 12:28 UTC
[Rd] showMethods("plot", printTo=FALSE) fails if printTo set to FALSE
On Wed, 20 Aug 2008, Sklyar, Oleg (London) wrote:> Hi everybody, > > any idea why showMethods fails with the following error when printTo is > set to false, i.e. to return the output as a character vector. It works > fine if printTo is left default as seen below. The behaviour is > consistent for any method I tried. stdin() generally works fine on this > system, at least when checked with: x = readLines(). > > Thanks, > Oleg > >> x = showMethods("plot", printTo=FALSE) > Error in cat(file = printTo, sep = "", ...) : > cannot switch output to stdinThis has coerced FALSE to 0, which is connection stdin(). You cannot write to stdin. I see no sign that printTo = FALSE has been implemented. You could use a text connection, e.g. con <- textConnection(NULL, open="w") x <- showMethods("plot", printTo=con) textConnectionValue(con) close(con)> > Enter a frame number, or 0 to exit > > 1: showMethods("plot", printTo = FALSE) > 2: .showMethodsTable(fdef, includeDefs, inherited, classes = classes, > showEmpt > 3: doFun(f, p) > 4: cf("Function: ", func, " (package ", pkg, ")\n") > 5: cat(file = printTo, sep = "", ...) > > Selection: 0 >> x = showMethods("plot") > Function: plot (package graphics) > x="ANY", y="ANY" > x="SimResults", y="SimResults" > x="SimResults", y="missing" > x="TimeDateBase", y="character" > x="TimeDateBase", y="data.frameOrMatrix" > x="TimeDateBase", y="missing" > x="TimeSeries", y="missing" > >> sessionInfo() > R version 2.8.0 Under development (unstable) (2008-08-05 r46234) > x86_64-unknown-linux-gnu > > locale: > C > > attached base packages: > [1] datasets splines utils stats graphics grDevices methods > > [8] base > > other attached packages: > > ## 64bit RHEL 5 > > > Dr Oleg Sklyar > Technology Group > Man Investments Ltd > +44 (0)20 7144 3803 > osklyar at maninvestments.com > > > ********************************************************************** > The contents of this email are for the named addressee(s...{{dropped:22}} > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Sklyar, Oleg (London)
2008-Aug-20 12:39 UTC
[Rd] showMethods("plot", printTo=FALSE) fails if printTo set to FALSE
Thanks for a good tip. Dr Oleg Sklyar Technology Group Man Investments Ltd +44 (0)20 7144 3803 osklyar at maninvestments.com> -----Original Message----- > From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] > Sent: 20 August 2008 13:29 > To: Sklyar, Oleg (London) > Cc: r-devel at stat.math.ethz.ch > Subject: Re: [Rd] showMethods("plot", printTo=FALSE) fails if > printTo set to FALSE > > On Wed, 20 Aug 2008, Sklyar, Oleg (London) wrote: > > > Hi everybody, > > > > any idea why showMethods fails with the following error > when printTo is > > set to false, i.e. to return the output as a character > vector. It works > > fine if printTo is left default as seen below. The behaviour is > > consistent for any method I tried. stdin() generally works > fine on this > > system, at least when checked with: x = readLines(). > > > > Thanks, > > Oleg > > > >> x = showMethods("plot", printTo=FALSE) > > Error in cat(file = printTo, sep = "", ...) : > > cannot switch output to stdin > > This has coerced FALSE to 0, which is connection stdin(). You cannot > write to stdin. > > I see no sign that printTo = FALSE has been implemented. You > could use a > text connection, e.g. > > con <- textConnection(NULL, open="w") > x <- showMethods("plot", printTo=con) > textConnectionValue(con) > close(con) > > > > > Enter a frame number, or 0 to exit > > > > 1: showMethods("plot", printTo = FALSE) > > 2: .showMethodsTable(fdef, includeDefs, inherited, classes > = classes, > > showEmpt > > 3: doFun(f, p) > > 4: cf("Function: ", func, " (package ", pkg, ")\n") > > 5: cat(file = printTo, sep = "", ...) > > > > Selection: 0 > >> x = showMethods("plot") > > Function: plot (package graphics) > > x="ANY", y="ANY" > > x="SimResults", y="SimResults" > > x="SimResults", y="missing" > > x="TimeDateBase", y="character" > > x="TimeDateBase", y="data.frameOrMatrix" > > x="TimeDateBase", y="missing" > > x="TimeSeries", y="missing" > > > >> sessionInfo() > > R version 2.8.0 Under development (unstable) (2008-08-05 r46234) > > x86_64-unknown-linux-gnu > > > > locale: > > C > > > > attached base packages: > > [1] datasets splines utils stats graphics > grDevices methods > > > > [8] base > > > > other attached packages: > > > > ## 64bit RHEL 5 > > > > > > Dr Oleg Sklyar > > Technology Group > > Man Investments Ltd > > +44 (0)20 7144 3803 > > osklyar at maninvestments.com > > > > > > > ********************************************************************** > > The contents of this email are for the named > addressee(s...{{dropped:22}} > > > > ______________________________________________ > > R-devel at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel > > > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 >********************************************************************** The contents of this email are for the named addressee(s...{{dropped:22}}