Re: [Rd] directing print.packageInfo to a file

2004-08-01 Thread Prof Brian Ripley
On Mon, 2 Aug 2004, Kurt Hornik wrote:

> > Gabor Grothendieck writes:
> 
> > 
> > print.packageInfo does not print to the console, it uses file.show.
> > For example, on R 1.9.1 patched on Windows XP:
> > 
> >> require(chron)
> > [1] TRUE
> >> capture.output(print.packageInfo(help(package = chron)), file = "/abc.txt")
> > NULL
> >> length(readLines("/abc.txt"))
> > [1] 0
> 
> But file.show() can be tuned by playing with options(pager).
> 
> In your case, something like
> 
>   oop <- options(pager = function(file, ...) writeLines(readLines(file)))
>   capture.output(print.packageInfo(help(package = "stats")),
>file = "abc.txt")
>   options(oop)
> 
> gives
> 
> R> length(readLines("abc.txt"))
> [1] 345

or even

oop <- options(pager="console")

an internal version of the same thing under R for Windows.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] directing print.packageInfo to a file

2004-08-01 Thread Kurt Hornik
> Gabor Grothendieck writes:

> 
> print.packageInfo does not print to the console, it uses file.show.
> For example, on R 1.9.1 patched on Windows XP:
> 
>> require(chron)
> [1] TRUE
>> capture.output(print.packageInfo(help(package = chron)), file = "/abc.txt")
> NULL
>> length(readLines("/abc.txt"))
> [1] 0

But file.show() can be tuned by playing with options(pager).

In your case, something like

  oop <- options(pager = function(file, ...) writeLines(readLines(file)))
  capture.output(print.packageInfo(help(package = "stats")),
 file = "abc.txt")
  options(oop)

gives

R> length(readLines("abc.txt"))
[1] 345

Hth
-k





> 
> 
> Kurt Hornik <[EMAIL PROTECTED]> writes:
> 
> Gabor Grothendieck writes:
> 
>> There was a discussion on r-help of getting the output from
>> print.packageInfo into a file. Spencer and I have added a file=
>> argument to print.packageInfo for consideration in R. Had this
>> been available it would have simplified the answer to that
>> thread. If the file= argument is used then the packageInfo
>> information is sent to the file specified rather than displayed
>> using file.show .
> 
> What is wrong with
> 
>  capture.output(print.packageInfo(x, ...), file = NULL)
> 
> for what you want?
> 
> -k
> 
>> print.packageInfo <- function (x, ..., file = NULL)
>> {
>> if (!inherits(x, "packageInfo"))
>> stop("wrong class")
>> outFile <- if (is.null(file))
>> tempfile("RpackageInfo")
>> else
>> file
>> outConn <- file(outFile, open = "w")
>> vignetteMsg <- paste("Further information is available in the following ",
>> "vignettes in directory ", sQuote(file.path(x$path, "doc")),
>> ":", sep = "")
>> headers <- c("", "Description:\n\n", "Index:\n\n", paste(paste(strwrap
>> (vignetteMsg),
>> collapse = "\n"), "\n\n", sep = ""))
>> footers <- c("\n", "\n", "\n", "")
>> formatDocEntry <- function(entry) {
>> if (is.list(entry) || is.matrix(entry))
>> formatDL(entry, style = "list")
>> else entry
>> }
>> for (i in which(!sapply(x$info, is.null))) {
>> writeLines(headers[i], outConn, sep = "")
>> writeLines(formatDocEntry(x$info[[i]]), outConn)
>> writeLines(footers[i], outConn, sep = "")
>> }
>> close(outConn)
>> if (is.null(file))
>> file.show(outFile, delete.file = TRUE, title = paste
>> ("Documentation for package",
>> sQuote(x$name)))
>> invisible(x)
>> }
> 


> ___
> No banners. No pop-ups. No kidding.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] plot(x,y) core dump

2004-08-01 Thread Paul Murrell
Hi
Rf_allocNewX11DeviceDesc is called by newX11DeviceDriver and the latter 
needs to check the value returned.  I think Brian Ripley has made a fix 
for this problem in the development version of R.  The first few lines 
of newX11DeviceDriver now look like ...

newX11Desc *xd;
char *fn;
xd = Rf_allocNewX11DeviceDesc(pointsize);
if(!xd) return FALSE;
Unfortunately, your next problem may be that you can't start an X11 
device (it looks like you are failing to allocate memory for the device).

Paul
Liao, Kexiao wrote:
Dear R Development Team,
   I compile R-1.9.1 on AIX 5.2 under 2.9-aix51-020209, and xlf 7.1. In
order to let R compile successfully under gcc 2.9, I have to change one
C statement of file(RHOME//src/modules/X11/devX11.c) line 1768 from
"retrun FALSE" to "retrun NULL", following is C code snapshot:
 

newX11Desc * Rf_allocNewX11DeviceDesc(double ps)
{
newX11Desc *xd;
/* allocate new device description */
if (!(xd = (newX11Desc*)calloc(1, sizeof(newX11Desc
return NULL;
 

/* From here on, if we need to bail out with "error", */
/* then we must also free(xd). */
 

/*  Font will load at first use.  */
 

if (ps < 6 || ps > 24) ps = 12;
xd->fontface = -1;
xd->fontsize = -1;
xd->basefontface = 1;
xd->basefontsize = ps;
xd->handleOwnEvents = FALSE;
xd->window = (Window) NULL;
 

return(xd);
}
 

However I got core dump while I try to use plot() from R:
 

 

R : Copyright 2004, The R Foundation for Statistical Computing
Version 1.9.1  (2004-06-21), ISBN 3-900051-00-3
 

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
 

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R in publications.
 

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for a HTML browser interface to help.
Type 'q()' to quit R.
 


help.start()

Making links in per-session dir ...
If /usr/bin/netscape is already running, it is *not* restarted, and
you must switch to its window.
Otherwise, be patient ...

x <- rnorm(50)

y <- rnorm(x)

plot(x,y)

Illegal instruction (core dumped)
 

 

Can anyone give me some suggestion? Thanks!
 

 

Kexiao
 

[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] directing print.packageInfo to a file

2004-08-01 Thread Gabor Grothendieck


print.packageInfo does not print to the console, it uses file.show.
For example, on R 1.9.1 patched on Windows XP:

> require(chron)
[1] TRUE
>  capture.output(print.packageInfo(help(package = chron)), file = "/abc.txt")
NULL
> length(readLines("/abc.txt"))
[1] 0


Kurt Hornik <[EMAIL PROTECTED]> writes:

> Gabor Grothendieck writes:

> There was a discussion on r-help of getting the output from
> print.packageInfo into a file. Spencer and I have added a file=
> argument to print.packageInfo for consideration in R. Had this
> been available it would have simplified the answer to that
> thread. If the file= argument is used then the packageInfo
> information is sent to the file specified rather than displayed
> using file.show .

What is wrong with

 capture.output(print.packageInfo(x, ...), file = NULL)

for what you want?

-k

> print.packageInfo <- function (x, ..., file = NULL)
> {
> if (!inherits(x, "packageInfo"))
> stop("wrong class")
> outFile <- if (is.null(file))
>  tempfile("RpackageInfo")
> else
>  file
> outConn <- file(outFile, open = "w")
> vignetteMsg <- paste("Further information is available in the following ",
> "vignettes in directory ", sQuote(file.path(x$path, "doc")),
> ":", sep = "")
> headers <- c("", "Description:\n\n", "Index:\n\n", paste(paste(strwrap
> (vignetteMsg),
> collapse = "\n"), "\n\n", sep = ""))
> footers <- c("\n", "\n", "\n", "")
> formatDocEntry <- function(entry) {
> if (is.list(entry) || is.matrix(entry))
> formatDL(entry, style = "list")
> else entry
> }
> for (i in which(!sapply(x$info, is.null))) {
> writeLines(headers[i], outConn, sep = "")
> writeLines(formatDocEntry(x$info[[i]]), outConn)
> writeLines(footers[i], outConn, sep = "")
> }
> close(outConn)
> if (is.null(file))
>   file.show(outFile, delete.file = TRUE, title = paste
> ("Documentation for package",
>   sQuote(x$name)))
> invisible(x)
> }

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] directing print.packageInfo to a file

2004-08-01 Thread Kurt Hornik
> Gabor Grothendieck writes:

> There was a discussion on r-help of getting the output from 
> print.packageInfo into a file.  Spencer and I have added a file=
> argument to print.packageInfo for consideration in R.  Had this
> been available it would have simplified the answer to that
> thread.  If the file= argument is used then the packageInfo
> information is sent to the file specified rather than displayed
> using file.show .

What is wrong with

capture.output(print.packageInfo(x, ...), file = NULL)

for what you want?

-k

> print.packageInfo <- function (x, ..., file = NULL) 
> {
> if (!inherits(x, "packageInfo")) 
> stop("wrong class")
> outFile <- if (is.null(file))
>   tempfile("RpackageInfo")
> else
>   file
> outConn <- file(outFile, open = "w")
> vignetteMsg <- paste("Further information is available in the following ", 
> "vignettes in directory ", sQuote(file.path(x$path, "doc")), 
> ":", sep = "")
> headers <- c("", "Description:\n\n", "Index:\n\n", paste(paste(strwrap
> (vignetteMsg), 
> collapse = "\n"), "\n\n", sep = ""))
> footers <- c("\n", "\n", "\n", "")
> formatDocEntry <- function(entry) {
> if (is.list(entry) || is.matrix(entry)) 
> formatDL(entry, style = "list")
> else entry
> }
> for (i in which(!sapply(x$info, is.null))) {
> writeLines(headers[i], outConn, sep = "")
> writeLines(formatDocEntry(x$info[[i]]), outConn)
> writeLines(footers[i], outConn, sep = "")
> }
> close(outConn)
> if (is.null(file))
>   file.show(outFile, delete.file = TRUE, title = paste
> ("Documentation for package", 
>   sQuote(x$name)))
> invisible(x)
> }

> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


[Rd] 3.5 on Tiger

2004-08-01 Thread Jan de Leeuw
setenv CC gcc-3.5
setenv F77 gfortran
setenv CXX g++-3.5
What I had to do.
1. Build a local zlib-1.2.1
2. Compile ppr.f in stats with g77-3.4 and not with gfortran-3.5
3. Change line 1581 in plot.c to
   double *aa = REAL(cex);
if (R_FINITE(aa[i % ncex])
 i.e. get the assignment out of the macro
4. Disable the DO_STR_DIM macro in plot.c (and thus the
functions do_strheight and do_strwidth). This could be fixed by
expanding the macros and pasting into the source.
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R + OS X + gcc 3.5 = not quite there ..

2004-08-01 Thread Simon Urbanek
On Jul 31, 2004, at 9:15 PM, Jan de Leeuw wrote:
[cabledoc70:Developer/R/R-devel] deleeuw% bin/R
Error in lazyLoadDBfetch(key, datafile, compressed, envhook) :
internal error in decompress1
I forgot to post it here, but the problem I had was in libz (thanks to 
Luke for some tips). When I used system's libz then the problems went 
away. I suspect the supplied libz is miscompiled in some way, however I 
had no time yet to track it down exactly.

gfortran   -fno-common  -g -O2 -c ppr.f -o ppr.o
/var/tmp//ccSqEJAf.s:8241:FATAL:Symbol __BLOCK_DATA already 
defined.
Heh, I suspect it's the same code that my g77 cross-compiler hates, as 
I posed here few days ago ... got no response so far :/

and the "bad restore file magic number" errors are there as well.
That's the libz thing: what happens is the following: first load opens 
the file as gzip, that should work, but for some reason it doesn't, so 
load falls back to raw mode and tries to read it as-is, however then 
the magic number is bogus since it's actually gzipped, so load fails. 
If you use system's libz the file is decompressed correctly.

Cheers,
Simon
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel