Re: [Rd] "R CMD check" with R 2.0.0

2004-10-07 Thread Paul Murrell
Hi
Deepayan Sarkar wrote:
On Thursday 07 October 2004 08:55, Berwin A Turlach wrote:
G'day all,
I am not sure whether I should file this as a bug report, but I
thought that I should make the developers of R aware of the following
feature:
I have just installed R 2.0.0 and when I run "R CMD check" on the
source of some packages, I noticed that the XXX-examples.ps file
contains one page with two graphics overlaid.  This seems to happen
when the first graphic is produced that uses the lattice() package.
I.e. as long as the examples use non-lattice graphics command, each
graphic is on its own page; the first graphic produced by a lattice
command (well, xyplot each time in the packages tested) is put on the
same page as the last graphic, after this, each graphic is again on a
page off its own regardless of whether it was produced by a lattice
graphics command or a non-lattice graphics command.

I can confirm this, e.g. with 


postscript()
plot(1)
xyplot(2 ~ 2)
dev.off()

(not that obvious on screen because the dark background overwrites the 
first plot). The underlying reason seems to be grid not knowing whether 
to start a new page the first time:


x11()
plot(1)
grid.newpage()
grid.points(x = runif(10), y = runif(10), vp = viewport())

Paul, any ideas?

Yep, it's grid causing the problem.  The very first grid.newpage() on a 
device will not start a new page IF a traditional plot had previously 
been drawn on the device.  This will be fixed for 2.0.1.

In the meantime, there is a simple workaround for users.  On a screen 
device, the effect will probably not be noticed (as one of Deepayan's 
examples demonstrates).  On a file device like PostScript, it may mean 
people have to rerun code and insert a grid.newpage() before the first 
lattice call.

Apologies for the botch-up.
Paul
--
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://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] "R CMD check" with R 2.0.0

2004-10-07 Thread Edzer J. Pebesma
Deepayan, and others:
Paul already fixed this; he sent me this in an email on 10/04/04:
Kurt Hornik passed on to me your email about mixing traditional and 
lattice graphics.

The problem is in the grid package and should be fixed for 2.0.1, but 
for 2.0.0 the only solution is to make an extra call to grid.newpage() 
before the first lattice call (if there has been previous traditional 
graphics output).

Paul also noted that it will probably mostly come up there (in testing 
output).

Regards,
--
Edzer
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] two help problems in R-2.0.0 for Windows (PR#7269)

2004-10-07 Thread Prof Brian Ripley
On Thu, 7 Oct 2004 [EMAIL PROTECTED] wrote:

> Well, for htmlhelp, there is another error. The browser (e.g. Mozilla 
> 1.7.3) tries to open "T:\R\library\stats\html/Normal.html" and has 
> problems with different kinds of slashes (/ vs. \).

I can't reproduce that.  I get forward slashes only. Can you track down 
where the \ are coming from?

>   options(chmhelp=FALSE, htmlhelp=TRUE)
>   ?dnorm  # does not work!
> 
> 
> This can be fixed by changing line 4 in
> .../src/library/utils/R/windows/help.R
> as follows:
> 
> -browseURL(file)
> +browseURL(chartr("/", "\\", file))
> 
> 
> 
> 
> AArgh, I've never used non-text help pages in the developer releases 
> ... and obviously nobody else ...

Well, I have and Firefox works properly, for example.  I've not used
Mozilla recently as Firefox seems rather better.  I also checked, and IE6
works too.  Do you have a browser set (options(browser=)), or are you
relying on file associations?

Since this is to be a file:// URL, I believe forward slashes are correct, 
but we are at the mercy of Windows browser providers.

Brian

-- 
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://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] two help problems in R-2.0.0 for Windows (PR#7269)

2004-10-07 Thread ligges
R-2.0.0, WinNT / WinXP:

  options(chmhelp=TRUE)
  ?dnorm  # does not work!
  ?Normal # works!

Looks like calling compiled html help does not work for aliases, but 
only for the title of help pages...

And a quick fix without changing the design is to change lines
136-137 in .../src/library/utils/R/help.R as follows:

-err <- .C("Rchtml", hlpfile, topic,
-err = integer(1), PACKAGE = "")$err

+err <- .C("Rchtml", hlpfile, rev(strsplit(file, "/")[[1]])[1],
+err = integer(1), PACKAGE = "")$err

but I think it is a problem by design and the name of the help pages 
should be returned by help() as well (not only implicitly).





Well, for htmlhelp, there is another error. The browser (e.g. Mozilla 
1.7.3) tries to open "T:\R\library\stats\html/Normal.html" and has 
problems with different kinds of slashes (/ vs. \).

  options(chmhelp=FALSE, htmlhelp=TRUE)
  ?dnorm  # does not work!


This can be fixed by changing line 4 in
.../src/library/utils/R/windows/help.R
as follows:

-browseURL(file)
+browseURL(chartr("/", "\\", file))




AArgh, I've never used non-text help pages in the developer releases 
... and obviously nobody else ...

Uwe Ligges

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


Re: [Rd] "R CMD check" with R 2.0.0

2004-10-07 Thread Deepayan Sarkar
On Thursday 07 October 2004 08:55, Berwin A Turlach wrote:
> G'day all,
>
> I am not sure whether I should file this as a bug report, but I
> thought that I should make the developers of R aware of the following
> feature:
>
> I have just installed R 2.0.0 and when I run "R CMD check" on the
> source of some packages, I noticed that the XXX-examples.ps file
> contains one page with two graphics overlaid.  This seems to happen
> when the first graphic is produced that uses the lattice() package.
> I.e. as long as the examples use non-lattice graphics command, each
> graphic is on its own page; the first graphic produced by a lattice
> command (well, xyplot each time in the packages tested) is put on the
> same page as the last graphic, after this, each graphic is again on a
> page off its own regardless of whether it was produced by a lattice
> graphics command or a non-lattice graphics command.

I can confirm this, e.g. with 

> postscript()
> plot(1)
> xyplot(2 ~ 2)
> dev.off()

(not that obvious on screen because the dark background overwrites the 
first plot). The underlying reason seems to be grid not knowing whether 
to start a new page the first time:

> x11()
> plot(1)
> grid.newpage()
> grid.points(x = runif(10), y = runif(10), vp = viewport())

Paul, any ideas?

Deepayan

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


Re: [Rd] "R CMD check" with R 2.0.0

2004-10-07 Thread Roger Bivand
This is something Edzer Pebesma and I saw working on gstat and sp:

Edzer Pebesma to CRAN 1 October:

"WRT 2.0.0, I noted with gstat, and also with another package under
development (sp for spatial classes) that when mixing
traditional plots and lattice plots in the example sections,
the lattice plot overplots the last traditional plot -- a newpage
misses, so to speak. See gstat.Rcheck/gstat-Examples.ps"

Roger

On Thu, 7 Oct 2004, Berwin A Turlach wrote:

> G'day all,
> 
> I am not sure whether I should file this as a bug report, but I
> thought that I should make the developers of R aware of the following
> feature:
> 
> I have just installed R 2.0.0 and when I run "R CMD check" on the
> source of some packages, I noticed that the XXX-examples.ps file
> contains one page with two graphics overlaid.  This seems to happen
> when the first graphic is produced that uses the lattice() package.
> I.e. as long as the examples use non-lattice graphics command, each
> graphic is on its own page; the first graphic produced by a lattice
> command (well, xyplot each time in the packages tested) is put on the
> same page as the last graphic, after this, each graphic is again on a
> page off its own regardless of whether it was produced by a lattice
> graphics command or a non-lattice graphics command.
> 
> Cheers,
> 
> Berwin
> 
> --please do not edit the information below--
> 
> Version:
>  platform = i686-pc-linux-gnu
>  arch = i686
>  os = linux-gnu
>  system = i686, linux-gnu
>  status = 
>  major = 2
>  minor = 0.0
>  year = 2004
>  month = 10
>  day = 04
>  language = R
> 
> Search Path:
>  .GlobalEnv, package:methods, package:stats, package:graphics,
>  package:grDevices, package:utils, package:datasets, Autoloads,
>  package:base
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

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


[Rd] "R CMD check" with R 2.0.0

2004-10-07 Thread Berwin A Turlach
G'day all,

I am not sure whether I should file this as a bug report, but I
thought that I should make the developers of R aware of the following
feature:

I have just installed R 2.0.0 and when I run "R CMD check" on the
source of some packages, I noticed that the XXX-examples.ps file
contains one page with two graphics overlaid.  This seems to happen
when the first graphic is produced that uses the lattice() package.
I.e. as long as the examples use non-lattice graphics command, each
graphic is on its own page; the first graphic produced by a lattice
command (well, xyplot each time in the packages tested) is put on the
same page as the last graphic, after this, each graphic is again on a
page off its own regardless of whether it was produced by a lattice
graphics command or a non-lattice graphics command.

Cheers,

Berwin

--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = 
 major = 2
 minor = 0.0
 year = 2004
 month = 10
 day = 04
 language = R

Search Path:
 .GlobalEnv, package:methods, package:stats, package:graphics,
 package:grDevices, package:utils, package:datasets, Autoloads,
 package:base

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


Re: [Rd] sample suggestion

2004-10-07 Thread Duncan Murdoch
On Thu, 7 Oct 2004 09:00:01 +0200, [EMAIL PROTECTED] (Göran Broström)
wrote:

>I have been bitten by what is clearly described on the help page for
>'sample', namely sampling from a population of size one. I agree that it is
>convenient to have an exception if 'length(x) == 1', but my suggestion is
>to enforce the exception only if 'x' is numeric. In any case, if x is not
>numeric and of length 1, all you get is an error message.
>
>I would like 'sample("tre", 1)' to return "tre", and 'sample(3, 1)' to
>return a natural number less than 4. It seems easy to achieve that by
>changing the line
>
>if (length(x) == 1 && x >= 1) {
>
>to
>
>if (length(x) == 1 && is.numeric(x) && x >= 1) {
>
>in 'sample'.
>
>Isn't that a good idea? An alternative suggestion would be to implement
>'resample' (from the examples) in 'base'.

I agree that's a good suggestion; I think it would be even better to
add an extra argument to sample to say how to handle a length 1
population vector, e.g.

sample(x, size, replace = FALSE, prob = NULL, expand = is.numeric(x))

 ...

if (length(x) == 1 && expand && x >= 1) {

so that the resample() example would be simply

sample(x[x > 9], expand = FALSE)


The case of zero-length x would still need to be handled separately,
or generate an error.

Duncan Murdoch

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


[Rd] sample suggestion

2004-10-07 Thread Göran Broström
I have been bitten by what is clearly described on the help page for
'sample', namely sampling from a population of size one. I agree that it is
convenient to have an exception if 'length(x) == 1', but my suggestion is
to enforce the exception only if 'x' is numeric. In any case, if x is not
numeric and of length 1, all you get is an error message.

I would like 'sample("tre", 1)' to return "tre", and 'sample(3, 1)' to
return a natural number less than 4. It seems easy to achieve that by
changing the line

if (length(x) == 1 && x >= 1) {

to

if (length(x) == 1 && is.numeric(x) && x >= 1) {

in 'sample'.

Isn't that a good idea? An alternative suggestion would be to implement
'resample' (from the examples) in 'base'.

Göran

PS. Congratulations to the Core Team for reaching an excellent 2.0.0!   
-- 
 Göran Broströmtel: +46 90 786 5223
 Department of Statistics  fax: +46 90 786 6614
 Umeå University   http://www.stat.umu.se/egna/gb/
 SE-90187 Umeå, Sweden e-mail: [EMAIL PROTECTED]

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