Re: [Rd] Dead link in documentation for dbinom

2005-11-15 Thread Martin Maechler
Thank you, Ivan, for the documentation update;
Yes, such small "fixes"/patches are welcome as well.

Martin

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Package manpage DCF hooks

2005-11-15 Thread Martin Maechler
> "Paul" == Paul Roebuck <[EMAIL PROTECTED]>
> on Mon, 14 Nov 2005 15:57:04 -0600 (CST) writes:

Paul> On Mon, 14 Nov 2005, Gabor Grothendieck wrote:
>> On 11/14/05, Paul Roebuck <[EMAIL PROTECTED]> wrote:
>> 
>> > Was looking at what was output for -package.Rd
>> > and wondered if any there was any means (via macro, etc)
>> > to merge some of the same information with a template
>> > for my package manpage? As much (all?) of the generated
>> > information was already provided in the DESCRIPTION, I'd
>> > prefer not to have to update the information in multiple
>> > places. I'm thinking here that I could provide a template
>> > file "-package.Rd.in" and during build, the
>> > DCF information could be substituted appropriately and
>> > "-package.Rd" would be output.
>> >
>> > see also:
>> >promptPackage method
>> 
>> What I do is make my whatever-package.Rd page be
>> the central page where one can get a list of all
>> the other places one can look for info (rather than
>> placing the info itself there).  See, for example,
>> 
>> library(dyn)
>> package?dyn

Paul> Thanks for your reply. That gives me some additional
Paul> ideas but still think being able to display DCF
Paul> information and public function listing would be a nice
Paul> thing to have. For example, 'dyn-package.Rd' repeats its
Paul> DCF description.

which I agree is not ideal.  I agree that such information
should in principle reside in one place and be
``auto-distributed'' to other places during package installation
and maybe also package load time.

Note that  packageDescription("dyn")
returns an object that contains (and may print if you want) the
DCF information.

One possibility I see would be the convention that the 
'generated' (text, html, tex) help files for  'package-' 
would combine both the packageDescription() and
the contents of  -package.Rd.  

Martin

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Bug in the example of function optim() (PR#8312)

2005-11-15 Thread wolfgang . lederer
Dear R-Team,

there seems to be a minor bug in the example for optim(). In the 
travelling salseman part of the example section the lines

text(x, y, names(eurodist), cex=0.8)  (7th line from bottom)

text(x, y, names(eurodist), cex=0.8)  (last line)

do not produce any oputput, because names(eurodist) has value "NULL". To 
get the intended output one has just to substitute names() by labels(). 
So the correct line will be:

text(x, y, labels(eurodist), cex=0.8)  .

Thanks for all your effort and the software you created.

Greetings

Wolfgang Lederer

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status =
 major = 2
 minor = 2.0
 year = 2005
 month = 10
 day = 06
 svn rev = 35749
 language = R

Windows XP Professional (build 2600) Service Pack 2.0

Locale:
LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252

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

-- 
**
Wolfgang Lederer
Institut für Statistik
Ludwig-Maximilians-Universität München
Martius Str. 4
D-80539 München
Tel: +49 89 2180 4847
Fax: +49 89 2180 5308

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Bug in the example of function optim() (PR#8312)

2005-11-15 Thread ripley
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--27464147-1959301360-1132073234=:9778
Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

This is aleady fixed in the current versions of R, R-patched, and R-devel.
See the posting guide or FAQ for how you can check such versions
(and save your time and ours).

On Tue, 15 Nov 2005 [EMAIL PROTECTED] wrote:

> Dear R-Team,
>
> there seems to be a minor bug in the example for optim(). In the
> travelling salseman part of the example section the lines
>
> text(x, y, names(eurodist), cex=3D0.8)  (7th line from bottom)
>
> text(x, y, names(eurodist), cex=3D0.8)  (last line)
>
> do not produce any oputput, because names(eurodist) has value "NULL". To
> get the intended output one has just to substitute names() by labels().
> So the correct line will be:
>
> text(x, y, labels(eurodist), cex=3D0.8)  .
>
> Thanks for all your effort and the software you created.
>
> Greetings
>
> Wolfgang Lederer
>
> --please do not edit the information below--
>
> Version:
> platform =3D i386-pc-mingw32
> arch =3D i386
> os =3D mingw32
> system =3D i386, mingw32
> status =3D
> major =3D 2
> minor =3D 2.0
> year =3D 2005
> month =3D 10
> day =3D 06
> svn rev =3D 35749
> language =3D R
>
> Windows XP Professional (build 2600) Service Pack 2.0
>
> Locale:
> LC_COLLATE=3DGerman_Germany.1252;LC_CTYPE=3DGerman_Germany.1252;LC_MONETA=
RY=3DGerman_Germany.1252;LC_NUMERIC=3DC;LC_TIME=3DGerman_Germany.1252
>
> Search Path:
> .GlobalEnv, package:methods, package:stats, package:graphics,
> package:grDevices, package:utils, package:datasets, Autoloads, package:ba=
se
>
> --=20
> **
> Wolfgang Lederer
> Institut f=FCr Statistik
> Ludwig-Maximilians-Universit=E4t M=FCnchen
> Martius Str. 4
> D-80539 M=FCnchen
> Tel: +49 89 2180 4847
> Fax: +49 89 2180 5308
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

--=20
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
--27464147-1959301360-1132073234=:9778--

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Package manpage DCF hooks

2005-11-15 Thread Paul Roebuck
On Tue, 15 Nov 2005, Martin Maechler wrote:

> > "Paul" == Paul Roebuck <[EMAIL PROTECTED]>
> > on Mon, 14 Nov 2005 15:57:04 -0600 (CST) writes:
>
> Paul> On Mon, 14 Nov 2005, Gabor Grothendieck wrote:
> >> On 11/14/05, Paul Roebuck <[EMAIL PROTECTED]> wrote:
> >>
> >> > Was looking at what was output for -package.Rd
> >> > and wondered if any there was any means (via macro, etc)
> >> > to merge some of the same information with a template
> >> > for my package manpage? As much (all?) of the generated
> >> > information was already provided in the DESCRIPTION, I'd
> >> > prefer not to have to update the information in multiple
> >> > places. I'm thinking here that I could provide a template
> >> > file "-package.Rd.in" and during build, the
> >> > DCF information could be substituted appropriately and
> >> > "-package.Rd" would be output.
> >> >
> >> > see also:
> >> >promptPackage method
> >>
> >> What I do is make my whatever-package.Rd page be
> >> the central page where one can get a list of all
> >> the other places one can look for info (rather than
> >> placing the info itself there).  See, for example,
> >>
> >> library(dyn)
> >> package?dyn
>
> Paul> Thanks for your reply. That gives me some additional
> Paul> ideas but still think being able to display DCF
> Paul> information and public function listing would be a nice
> Paul> thing to have. For example, 'dyn-package.Rd' repeats its
> Paul> DCF description.
>
> which I agree is not ideal.  I agree that such information
> should in principle reside in one place and be
> ``auto-distributed'' to other places during package installation
> and maybe also package load time.
>
> Note that packageDescription("dyn") returns an object that
> contains (and may print if you want) the DCF information.

I'm aware of this, having used it in various places. What
I don't know is how to access/use it during package
installation (if even possible). Using read.dcf and a sed
script, I could probably manage to perform the template
merge. But I don't know how to invoke such without adding
a configure script (overkill for R-only packages), as
'install.R' is meant for something else.

> One possibility I see would be the convention that the
> 'generated' (text, html, tex) help files for 'package-'
> would combine both the packageDescription() and
> the contents of -package.Rd.

Well, a system-level approach would be preferable to doing
this per-package. R-2.3 then?

--
SIGSIG -- signature too long (core dumped)

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Bug or a feature that I completely missed?

2005-11-15 Thread Berwin A Turlach
Dear all,

while looking at some R-code submitted by students in a unit that I
teach, I came across constructs that I thought would lead to an error.
Much to my surprise, the code is actually executed.

A boiled down version of the code is the following:

> tt <- function(x, i){
+   mean(x[i,2])/mean(x[i,1])
+ }
> dat <- matrix(rnorm(200), ncol=2)
> mean(dat[,2])/mean(dat[,1])
[1] -1.163893
> dat1 <- data.frame(dat)
> tt(dat1) ###  Why does this work?
[1] -1.163893
> tt(dat)
Error in mean(x[i, 2]) : argument "i" is missing, with no default

Since the data for the assignment was in a data frame, the students got
an answer and not an error message when they called the equivalent of
tt(dat1) in their work.

I tested this code on R 1.8.1, 1.9.1, 2.0.0, 2.0.1, 2.1.0, 2.1.1,
2.2.0 and R-devel (2005-11-14 r36330), all with the same result, no
error message when executing tt(dat1).

I would have expected that tt(dat1) behaves in the same way as tt(dat)
and would produce an error.  Thus, I think it is a bug, but the fact
that so many R versions accept this code makes me wonder whether it is
a misunderstanding on my side.  Can somebody enlighten me why this
code is working?

Cheers,

Berwin

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Bug or a feature that I completely missed?

2005-11-15 Thread Gabor Grothendieck
On 11/15/05, Berwin A Turlach <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> while looking at some R-code submitted by students in a unit that I
> teach, I came across constructs that I thought would lead to an error.
> Much to my surprise, the code is actually executed.
>
> A boiled down version of the code is the following:
>
> > tt <- function(x, i){
> +   mean(x[i,2])/mean(x[i,1])
> + }
> > dat <- matrix(rnorm(200), ncol=2)
> > mean(dat[,2])/mean(dat[,1])
> [1] -1.163893
> > dat1 <- data.frame(dat)
> > tt(dat1) ###  Why does this work?
> [1] -1.163893
> > tt(dat)
> Error in mean(x[i, 2]) : argument "i" is missing, with no default
>
> Since the data for the assignment was in a data frame, the students got
> an answer and not an error message when they called the equivalent of
> tt(dat1) in their work.
>
> I tested this code on R 1.8.1, 1.9.1, 2.0.0, 2.0.1, 2.1.0, 2.1.1,
> 2.2.0 and R-devel (2005-11-14 r36330), all with the same result, no
> error message when executing tt(dat1).
>
> I would have expected that tt(dat1) behaves in the same way as tt(dat)
> and would produce an error.  Thus, I think it is a bug, but the fact
> that so many R versions accept this code makes me wonder whether it is
> a misunderstanding on my side.  Can somebody enlighten me why this
> code is working?
>

I don't have a complete explanation but consider:

f <- function(x) missing(x)
g <- function(x) f(x)
g()  # TRUE

That is, in R one can pass missing values from one
function to another and that is evidently what
is happening with tt which passes the missing
i to [.data.frame.  The weird part, to me, is that
[ does not also allow this even though it does allow
empty arguments though likely its due to
[ being written in C and [.data.frame being
written in R.

Try

getAnywhere("[.data.frame")
getAnywhere("[")

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel