Re: [Rd] pnorm problem (PR#7302)

2004-10-21 Thread Morten Welinder

Mea culpa.

Chalk this up to incorrect mucking with the trunc function on my
side, a very old bug here.  Apologies.

Morten

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


Re: [Rd] pnorm problem (PR#7302)

2004-10-21 Thread Prof Brian Ripley
On Thu, 21 Oct 2004, Uwe Ligges wrote:

> [EMAIL PROTECTED] wrote:
> > Full_Name: Morten Welinder
> > Version: 2
> > OS: Solaris(sparc)
> > Submission from: (NULL) (65.213.85.208)
> > 
> 
> Works for me with R-2.0.0, Solaris 5.7 (UltraSparc), gcc-3.2.3, 32-bit.
> So you have to specify compiler version, OS version, R version etc. much 
> more precisely.

And for me under Solaris 8, gcc-3.4.2 or Sun cc Forte 7, 32- or 64-bit, 
with options as recommended in R-admin.

I suspect this is caused by unsafe compiler options.

> > (gdb) p pnorm(-10.1, 0.0, 1.0, 0, 1)
> > $42 = NaN(0xf)
> > 
> > Expected: -0
> > 
> > (gdb) p pnorm(-10.0, 0.0, 1.0, 0, 1)
> > $43 = -0
> > 
> > Good.
> > 
> > (I know this is not a typical usage.)

-- 
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


Re: [Rd] pnorm problem (PR#7302)

2004-10-21 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:
Full_Name: Morten Welinder
Version: 2
OS: Solaris(sparc)
Submission from: (NULL) (65.213.85.208)
Works for me with R-2.0.0, Solaris 5.7 (UltraSparc), gcc-3.2.3, 32-bit.
So you have to specify compiler version, OS version, R version etc. much 
more precisely.

Uwe Ligges

(gdb) p pnorm(-10.1, 0.0, 1.0, 0, 1)
$42 = NaN(0xf)
Expected: -0
(gdb) p pnorm(-10.0, 0.0, 1.0, 0, 1)
$43 = -0
Good.
(I know this is not a typical usage.)
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] pnorm problem (PR#7302)

2004-10-21 Thread terra
Full_Name: Morten Welinder
Version: 2
OS: Solaris(sparc)
Submission from: (NULL) (65.213.85.208)


(gdb) p pnorm(-10.1, 0.0, 1.0, 0, 1)
$42 = NaN(0xf)

Expected: -0

(gdb) p pnorm(-10.0, 0.0, 1.0, 0, 1)
$43 = -0

Good.

(I know this is not a typical usage.)

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


Re: [Rd] error in plot.dendrogram (PR#7300)

2004-10-21 Thread maechler
> "Witold" == Witold Eryk Wolski <[EMAIL PROTECTED]>
> on Thu, 21 Oct 2004 16:52:26 +0200 writes:

Witold> Hi,
Witold> First. If you should not do it like you write here. You will get an 
Witold> error loading the rda file. It is a binary format.

Witold> Error in load(dFile) : input has been corrupted, with LF replaced by CR

no. I don't get such an error. 

Witold> Hence, you should specify mode="wb" for downloading binary formats.

ok, at least to be on the safe side.
{Though I *never* had the need till now, and it's not the first
 time I download.file( "./*.rda" ) .}

Witold> Try this code.

Witold> file.remove("hres.rda")

Witold> dFile <- paste(getwd(),"/hres.rda",sep="")
Witold> if(!file.exists(dFile))
Witold> download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda";, dest= 
dFile,mode="wb")
Witold> load(dFile)

Witold> hresd
Witold> plot(hresd)

Witold> In one think you are right, the X axis. But there is an ERROR.

Witold> On my Machine (see previous mail) not the complete dendrogram is drawn. 
Witold> It just draws the first 100 leavs out of 380 when I run
Witold> Second.  Even if I increase the size of the window maximally the 
Witold> dendrogram is not plotted.
Witold> And I checked it just again on a linux box. And it does not work there 
Witold> either.

well, it does work on mine...
(as I said, I quickly saw how unuseful single-linkage is for
 this data/dissimilarity ..)

ok, ok, -- now I see why:

I "just knew" that for largish dendrograms one had to do
something like

  options(expressions = 1)

before anything reasonable can happen.. ;-)

So, yes, I finally see your problem.

The real R bug there is that no error message is *printed*,
for me at least, but the recursive function calls to plotNode()
just bail out.

If you do 
   str(hresd)
you at least get an error message that helps you find out about
options(expressions = ..)...


Witold> How the dendrogram should look like you can figure out looking at the 
Witold> following.

Witold> hclustObj <- paste(getwd(),"/hress.rda",sep="")
Witold> if(!file.exists(dFile))
Witold> download.file(url ="http://www.molgen.mpg.de/~wolski/hress.rda";, dest= 
hclustObj ,mode="wb")
Witold> load(dFile)

(well, that doesn't work since you have replaced "dFile" by "hclustObj"
 in some places but not all.
 [[[ why on earth do you call a file name an object ?]]]
)

Witold> hress
Witold> plot(hress)

Witold> hressd<-as.dendrogram(hress)
Witold> plot(hressd)


Witold> Third. I have expected this comment about if it is meaningfull or not.
Witold> First for what I need it is it meaningfull. Second it is a valid 
Witold> dendrogram generated by as.dendrogram from a vaild hclust object. I do 
Witold> not need a plot routine which teaches me what she thinks is meaningfull 
Witold> or not.

agreed on that.

Note that originally in your bug report,
you were telling about a missing x-axis and that set off the
whole track since, as we now agree, it's not about an x-axis at all...




Witold> Martin Maechler wrote:

>>> "Eryk" == Eryk Wolski <[EMAIL PROTECTED]>
>>> on Thu, 21 Oct 2004 13:41:29 +0200 (CEST) writes:
>>> 
>>> 
>> 
Eryk> Hi,
>> 
Eryk> hres <- hclust(smatr,method="single")
Eryk> hresd<-as.dendrogram(hres)
Eryk> as.dendrogram(hres)
Eryk> `dendrogram' with 2 branches and 380 members total, at height 2514.513 
Eryk> plot(hresd,leaflab="none") #<-error here.
>> 
>> definitely no error here.. maybe your graphic window is too
>> small or otherwise unable to show all the leaf labels?
>> 
Eryk> #the plotted dendrogram is incomplete. The x axis is not drawn.
>> 
>> ha! and why should this be a bug
>> Have you RTFHP and looked at its example??
>> There's never an x-axis in such a plot!
>> 
>> [You really don't want an x-axis overlayed over all the labels]
>> 
Eryk> #The interested reader can download the
>> 
Eryk> save(hresd,file="hres.rda")
>> 
Eryk> #from the following loacation
Eryk> www.molgen.mpg.de/~wolski/hres.rda
>> 
>> If you send a bug report (and please rather don't..),
>> it should be reproducible, i.e., I've just wasted my time for 
>> 
>> dFile <- "/u/maechler/R/MM/Pkg-ex/stats/wolski-hres.rda"
>> if(!file.exists(dFile))
>> download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda";, dest= dFile)
>> load(dFile)
>> hresd
>> plot(hresd)
>> 
>> 
>> 
>> If you look at this plot I hope you rather see that "single" has
>> been an extremly unuseful clustering method for this data / dissimilarities,
>> and you'd rather tried other methods than to which for an
>> x-axis.
>> 
>> If you really want one (just to see that it doesn't make sense),
>> you can always add
>> 

[Rd] untrace() failing {when "methods" are active} (PR#7301)

2004-10-21 Thread maechler
This happens in R-2.0.0 (or R-patched or R-devel of this night):

> trace(axis)
> untrace(axis)
Error in .assignOverBinding(what, newFun, whereF, global) : 
Object "newFun" not found

> traceback()
6: .assignOverBinding(what, newFun, whereF, global)
5: methods::.TraceWithMethods(axis, where = , untrace = TRUE)
4: eval(expr, envir, enclos)
3: eval(expr, p)
2: eval.parent(call)
1: untrace(axis)

---
I've quickly tried to run R without "methods" and there,
untrace() doesn't fail {inside untrace(), the other if()-branch
is used}.

Martin

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


Re: [Rd] error in plot.dendrogram (PR#7300)

2004-10-21 Thread wolski
Hi,

First. If you should not do it like you write here. You will get an 
error loading the rda file. It is a binary format.

Error in load(dFile) : input has been corrupted, with LF replaced by CR


Hence, you should specify mode="wb" for downloading binary formats.

Try this code.


file.remove("hres.rda")

dFile <- paste(getwd(),"/hres.rda",sep="")
if(!file.exists(dFile))
download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda";, dest= 
dFile,mode="wb")
load(dFile)

hresd
plot(hresd)

In one think you are right, the X axis. But there is an ERROR.

On my Machine (see previous mail) not the complete dendrogram is drawn. 
It just draws the first 100 leavs out of 380 when I run
Second.  Even if I increase the size of the window maximally the 
dendrogram is not plotted.
And I checked it just again on a linux box. And it does not work there 
either.

How the dendrogram should look like you can figure out looking at the 
following.

hclustObj <- paste(getwd(),"/hress.rda",sep="")
if(!file.exists(dFile))
download.file(url ="http://www.molgen.mpg.de/~wolski/hress.rda";, dest= hclustObj 
,mode="wb")
load(dFile)

hress
plot(hress)

hressd<-as.dendrogram(hress)
plot(hressd)


Third. I have expected this comment about if it is meaningfull or not.
 First for what I need it is it meaningfull. Second it is a valid 
dendrogram generated by as.dendrogram from a vaild hclust object. I do 
not need a plot routine which teaches me what she thinks is meaningfull 
or not.


/E





Martin Maechler wrote:

>>"Eryk" == Eryk Wolski <[EMAIL PROTECTED]>
>>on Thu, 21 Oct 2004 13:41:29 +0200 (CEST) writes:
>>
>>
>
>Eryk> Hi,
>
>Eryk> hres <- hclust(smatr,method="single")
>Eryk> hresd<-as.dendrogram(hres)
>Eryk> as.dendrogram(hres)
>Eryk> `dendrogram' with 2 branches and 380 members total, at height 2514.513 
>Eryk> plot(hresd,leaflab="none") #<-error here.
>
>definitely no error here.. maybe your graphic window is too
>small or otherwise unable to show all the leaf labels?
>
>Eryk> #the plotted dendrogram is incomplete. The x axis is not drawn.
>
>ha! and why should this be a bug
>Have you RTFHP and looked at its example??
>There's never an x-axis in such a plot!
>
>[You really don't want an x-axis overlayed over all the labels]
>
>Eryk> #The interested reader can download the
>
>Eryk> save(hresd,file="hres.rda")
>
>Eryk> #from the following loacation
>Eryk> www.molgen.mpg.de/~wolski/hres.rda
>
>If you send a bug report (and please rather don't..),
>it should be reproducible, i.e., I've just wasted my time for 
>
>dFile <- "/u/maechler/R/MM/Pkg-ex/stats/wolski-hres.rda"
>if(!file.exists(dFile))
>download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda";, dest= dFile)
>load(dFile)
>hresd
>plot(hresd)
>
>
>
>If you look at this plot I hope you rather see that "single" has
>been an extremly unuseful clustering method for this data / dissimilarities,
>and you'd rather tried other methods than to which for an
>x-axis.
>
>If you really want one (just to see that it doesn't make sense),
>you can always add
>axis(1, fg = "red")
>
>Martin
>
>  
>


-- 
Dipl. bio-chem. Witold Eryk Wolski
MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin
tel: 0049-30-83875219 __("<_
http://www.molgen.mpg.de/~wolski  \__/'v'
http://r4proteomics.sourceforge.net||/   \
mail: [EMAIL PROTECTED]^^ m m
  [EMAIL PROTECTED]

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


Re: [Rd] error in plot.dendrogram (PR#7300)

2004-10-21 Thread Witold Eryk Wolski
Hi,
First. If you should not do it like you write here. You will get an 
error loading the rda file. It is a binary format.

Error in load(dFile) : input has been corrupted, with LF replaced by CR
Hence, you should specify mode="wb" for downloading binary formats.
Try this code.
file.remove("hres.rda")
dFile <- paste(getwd(),"/hres.rda",sep="")
if(!file.exists(dFile))
   download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda";, dest= 
dFile,mode="wb")
load(dFile)
hresd
plot(hresd)
In one think you are right, the X axis. But there is an ERROR.
On my Machine (see previous mail) not the complete dendrogram is drawn. 
It just draws the first 100 leavs out of 380 when I run
Second.  Even if I increase the size of the window maximally the 
dendrogram is not plotted.
And I checked it just again on a linux box. And it does not work there 
either.

How the dendrogram should look like you can figure out looking at the 
following.

hclustObj <- paste(getwd(),"/hress.rda",sep="")
if(!file.exists(dFile))
   download.file(url ="http://www.molgen.mpg.de/~wolski/hress.rda";, dest= hclustObj 
,mode="wb")
load(dFile)
hress
plot(hress)
hressd<-as.dendrogram(hress)
plot(hressd)
Third. I have expected this comment about if it is meaningfull or not.
First for what I need it is it meaningfull. Second it is a valid 
dendrogram generated by as.dendrogram from a vaild hclust object. I do 
not need a plot routine which teaches me what she thinks is meaningfull 
or not.

/E


Martin Maechler wrote:
"Eryk" == Eryk Wolski <[EMAIL PROTECTED]>
   on Thu, 21 Oct 2004 13:41:29 +0200 (CEST) writes:
   

   Eryk> Hi,
   Eryk> hres <- hclust(smatr,method="single")
   Eryk> hresd<-as.dendrogram(hres)
   Eryk> as.dendrogram(hres)
   Eryk> `dendrogram' with 2 branches and 380 members total, at height 2514.513 
   Eryk> plot(hresd,leaflab="none") #<-error here.

definitely no error here.. maybe your graphic window is too
small or otherwise unable to show all the leaf labels?
   Eryk> #the plotted dendrogram is incomplete. The x axis is not drawn.
ha! and why should this be a bug
Have you RTFHP and looked at its example??
There's never an x-axis in such a plot!
[You really don't want an x-axis overlayed over all the labels]
   Eryk> #The interested reader can download the
   Eryk> save(hresd,file="hres.rda")
   Eryk> #from the following loacation
   Eryk> www.molgen.mpg.de/~wolski/hres.rda
If you send a bug report (and please rather don't..),
it should be reproducible, i.e., I've just wasted my time for 

dFile <- "/u/maechler/R/MM/Pkg-ex/stats/wolski-hres.rda"
if(!file.exists(dFile))
   download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda";, dest= dFile)
load(dFile)
hresd
plot(hresd)

If you look at this plot I hope you rather see that "single" has
been an extremly unuseful clustering method for this data / dissimilarities,
and you'd rather tried other methods than to which for an
x-axis.
If you really want one (just to see that it doesn't make sense),
you can always add
   axis(1, fg = "red")
Martin
 


--
Dipl. bio-chem. Witold Eryk Wolski
MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin
tel: 0049-30-83875219 __("<_
http://www.molgen.mpg.de/~wolski  \__/'v'
http://r4proteomics.sourceforge.net||/   \
mail: [EMAIL PROTECTED]^^ m m
 [EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] error in plot.dendrogram (PR#7300)

2004-10-21 Thread Martin Maechler
> "Eryk" == Eryk Wolski <[EMAIL PROTECTED]>
> on Thu, 21 Oct 2004 13:41:29 +0200 (CEST) writes:

Eryk> Hi,

Eryk> hres <- hclust(smatr,method="single")
Eryk> hresd<-as.dendrogram(hres)
Eryk> as.dendrogram(hres)
Eryk> `dendrogram' with 2 branches and 380 members total, at height 2514.513 
Eryk> plot(hresd,leaflab="none") #<-error here.

definitely no error here.. maybe your graphic window is too
small or otherwise unable to show all the leaf labels?

Eryk> #the plotted dendrogram is incomplete. The x axis is not drawn.

ha! and why should this be a bug
Have you RTFHP and looked at its example??
There's never an x-axis in such a plot!

[You really don't want an x-axis overlayed over all the labels]

Eryk> #The interested reader can download the

Eryk> save(hresd,file="hres.rda")

Eryk> #from the following loacation
Eryk> www.molgen.mpg.de/~wolski/hres.rda

If you send a bug report (and please rather don't..),
it should be reproducible, i.e., I've just wasted my time for 

dFile <- "/u/maechler/R/MM/Pkg-ex/stats/wolski-hres.rda"
if(!file.exists(dFile))
download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda";, dest= dFile)
load(dFile)
hresd
plot(hresd)



If you look at this plot I hope you rather see that "single" has
been an extremly unuseful clustering method for this data / dissimilarities,
and you'd rather tried other methods than to which for an
x-axis.

If you really want one (just to see that it doesn't make sense),
you can always add
axis(1, fg = "red")

Martin

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


[Rd] methods package: hasArg -- typo in description?

2004-10-21 Thread Pfaff, Bernhard
Dear list member / core group member,

although I am not a native English speaking person, but it seems that in the
description passage of hasArg it should read:

"Returns TRUE if name corresponds to"
instead of
"Returns TRUE is name corresponds to"  
as currently (R 2.0.0 non-patched)

Best Regards,
Bernhard


Dr. Bernhard Pfaff
Global Debt Research - Index and Quantitative Strategy
Dresdner Kleinwort Wasserstein
Phone:  +49 (0)69 713 12273 
Mobile: na 
Fax:+49 (0)69 713 19816


Bloomberg: DRKW




The information contained herein is confidential and is inte...{{dropped}}

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


Re: [Rd] C++ dev

2004-10-21 Thread Roger Bivand
On Thu, 21 Oct 2004, Sandrine Coelho wrote:

> Hello,
> I wish to use R functions in a C++ programm.

> I have installed D COM Server but with this application i think it isn't
> possible to acces mouse event..., is it true?

> My second idea is to compile libraries which are used, but i haven't
> source code, and the libraries existing are compiled under unix, but i'd
> like have .lib and .dll

I think the second choice is feasible for your needs, avoiding the 
overhead of writing your own application with a COM client. An example is 
the ongoing work on embedding R into Terralib:

http://www.est.ufpr.br/myR

which you may find interesting to look at - they say:

"There are three ways to have access the functions of the R. These options 
have advantages and disadvantages. The first form is to call it from 
batch, that is a system call, and has as disadvantage to call the R all 
time that it has a statistic operation to be executed. The second way is 
using the Rserve, that is a server TCP/IP, and is necessary a connection 
for the net. The third option is using the dynamic library libR. The only 
disadvantage of this option is the implementation of the access interface. 
Therefore our work focus on the development of this interface.

The functions implemented are: to initialize R, to declare and to liberate 
variables inside, and to execute R functions. myR has proved steady and 
robust as an interface with R. Further development consists of using myR 
in a real program, the TerraLib/TerraView, a GIS free and open source 
software."

The source code (sorry, for Linux) is there, but I believe the developers 
have Windows experience too.

You may find some of the functions they use useful if this is connected to 
GEOXP.

Best wishes,

Roger

> Thanks for your informations
> Sandrine
> 
> __
> [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] error in plot.dendrogram (PR#7300)

2004-10-21 Thread wolski
Hi,

hres <- hclust(smatr,method="single")
hresd<-as.dendrogram(hres)
as.dendrogram(hres)
`dendrogram' with 2 branches and 380 members total, at height 2514.513 

plot(hresd,leaflab="none") #<-error here.

#the plotted dendrogram is incomplete. The x axis is not drawn.

#The interested reader can download the

save(hresd,file="hres.rda")

#from the following loacation
www.molgen.mpg.de/~wolski/hres.rda


Yours
/E




--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = Patched
 major = 2
 minor = 0.0
 year = 2004
 month = 10
 day = 04
 language = R

Windows XP Professional (build 2600) Service Pack 1.0

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


[Rd] C++ dev

2004-10-21 Thread Sandrine Coelho
Hello,
I wish to use R functions in a C++ programm.
I have installed D COM Server but with this application i think it isn't possible to 
acces mouse event..., is it true?
My second idea is to compile libraries which are used, but i haven't source code, and 
the libraries existing are compiled under unix, but i'd like have .lib and .dll
Thanks for your informations
Sandrine

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


Re: [Rd] documentation for rank() (PR#7298)

2004-10-21 Thread Prof Brian Ripley
On Thu, 21 Oct 2004, Douglas Grove wrote:

> 
> 
> On Thu, 21 Oct 2004, Prof Brian Ripley wrote:
> 
> > On Wed, 20 Oct 2004, Douglas Grove wrote:
> > 
> > > Oh crap.  So sorry.  This is my fault (obviously).
> > > Prior to the new ties methods being added in 2.0.0
> > > I modified the source to do this myself.  So looks
> > > like I forgot: (1) that my modified code was still
> > > being accessed default (thought I'd removed it) and
> > > (2) that I had added in the 'decreasing' argument.
> > > 
> > > It did seem very odd to me when I saw the undocumented
> > > argument.
> > > 
> > > Sorry for the this faulty bug report.
> > > 
> > > BTW, would someone please add a 'decreasing' argument to rank.
> > > It seems natural to have one, just like sort, and only
> > > involves about two lines of code and a few lines of
> > > editing to the help file. 
> > 
> > I don't think so.  At the very least, each tie method needs a change, as 
> > may the handling of NAs.  Also the writing a comprehensible help page will 
> > become very complex.
> >
> > What is the need?  Rank works for numeric vectors, and why can't you just
> > call rank(-x) or n+1-rank(x)?  The reason that does not work for sort() is
> > that it deals with non-numeric vectors.
> 
> As you note there isn't a need, I just am used to thinking about
> ranking and sorting as being either increasing (the default) or
> decreasing, having an explicit 'decreasing' option makes the 
> the code more transparent.  It's a minor thing but as I erroneously
> supposed it to be easy, it seemed worthwhile. 
> 
> You're right that there would need to be a special case for at least
> ties.method='first', but I think for the others just using
>  if (decreasing) x <- -x 
> should be all that is needed.  

Looks like rank() does actually work for non-numeric vectors (even though
it was not documented to do so), which complicates things further.

> > Incidentally, we might need a `last' value for ties.method.
> 
> I don't see that my suggestion necessitates that.  However one
> could argue for a 'last' value in ties.method for completeness.
> I personally have had no need for 'first' nor would I for 'last'.

If you allow decreasing values, then I suspect you want a stable sort 
variant, which would be `last' not `first'.  Certainly `first' makes no 
sense.

-- 
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


Re: [Rd] documentation for rank() (PR#7298)

2004-10-21 Thread dgrove


On Thu, 21 Oct 2004, Prof Brian Ripley wrote:

> On Wed, 20 Oct 2004, Douglas Grove wrote:
> 
> > Oh crap.  So sorry.  This is my fault (obviously).
> > Prior to the new ties methods being added in 2.0.0
> > I modified the source to do this myself.  So looks
> > like I forgot: (1) that my modified code was still
> > being accessed default (thought I'd removed it) and
> > (2) that I had added in the 'decreasing' argument.
> > 
> > It did seem very odd to me when I saw the undocumented
> > argument.
> > 
> > Sorry for the this faulty bug report.
> > 
> > BTW, would someone please add a 'decreasing' argument to rank.
> > It seems natural to have one, just like sort, and only
> > involves about two lines of code and a few lines of
> > editing to the help file. 
> 
> I don't think so.  At the very least, each tie method needs a change, as 
> may the handling of NAs.  Also the writing a comprehensible help page will 
> become very complex.
>
> What is the need?  Rank works for numeric vectors, and why can't you just
> call rank(-x) or n+1-rank(x)?  The reason that does not work for sort() is
> that it deals with non-numeric vectors.

As you note there isn't a need, I just am used to thinking about
ranking and sorting as being either increasing (the default) or
decreasing, having an explicit 'decreasing' option makes the 
the code more transparent.  It's a minor thing but as I erroneously
supposed it to be easy, it seemed worthwhile. 

You're right that there would need to be a special case for at least
ties.method='first', but I think for the others just using
 if (decreasing) x <- -x 
should be all that is needed.  


> Incidentally, we might need a `last' value for ties.method.

I don't see that my suggestion necessitates that.  However one
could argue for a 'last' value in ties.method for completeness.
I personally have had no need for 'first' nor would I for 'last'.


> -- 
> 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


Re: [Rd] documentation for rank() (PR#7298)

2004-10-21 Thread Douglas Grove


On Thu, 21 Oct 2004, Prof Brian Ripley wrote:

> On Wed, 20 Oct 2004, Douglas Grove wrote:
> 
> > Oh crap.  So sorry.  This is my fault (obviously).
> > Prior to the new ties methods being added in 2.0.0
> > I modified the source to do this myself.  So looks
> > like I forgot: (1) that my modified code was still
> > being accessed default (thought I'd removed it) and
> > (2) that I had added in the 'decreasing' argument.
> > 
> > It did seem very odd to me when I saw the undocumented
> > argument.
> > 
> > Sorry for the this faulty bug report.
> > 
> > BTW, would someone please add a 'decreasing' argument to rank.
> > It seems natural to have one, just like sort, and only
> > involves about two lines of code and a few lines of
> > editing to the help file. 
> 
> I don't think so.  At the very least, each tie method needs a change, as 
> may the handling of NAs.  Also the writing a comprehensible help page will 
> become very complex.
>
> What is the need?  Rank works for numeric vectors, and why can't you just
> call rank(-x) or n+1-rank(x)?  The reason that does not work for sort() is
> that it deals with non-numeric vectors.

As you note there isn't a need, I just am used to thinking about
ranking and sorting as being either increasing (the default) or
decreasing, having an explicit 'decreasing' option makes the 
the code more transparent.  It's a minor thing but as I erroneously
supposed it to be easy, it seemed worthwhile. 

You're right that there would need to be a special case for at least
ties.method='first', but I think for the others just using
 if (decreasing) x <- -x 
should be all that is needed.  


> Incidentally, we might need a `last' value for ties.method.

I don't see that my suggestion necessitates that.  However one
could argue for a 'last' value in ties.method for completeness.
I personally have had no need for 'first' nor would I for 'last'.


> -- 
> 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