Re: [Rd] Bug in cor function (PR#7689)

2005-02-13 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 I can't hardly accept the result of  cor function with 
 pairwize.colplete.obs or complete.obs
 
 insert print statements in cor function,
 
 
 + if (method != pearson) {
   + Rank - function(u) if (is.matrix(u))
   + apply(u, 2, rank, na.last = keep)
   + else rank(u, na.last = keep)
   + x - Rank(x)
   + print(x) # add
   + if (!is.null(y)) {
   + y - Rank(y)
   + print(y) # add
   + }
   + }
   + .Internal(cor(x, y, na.method, method == kendall))
 
 and, data is
x - c(7, 9, 8,  0, NA, NA)
y - c(2, 3, 4, NA,  4,  3)
 
 and, call cor function
cor(x, y, use=pair, method=sp)
 
 order of x, and y are
   [1]  2  4  3  1 NA NA
   [1] 1.0 2.5 4.5  NA 4.5 2.5
 
 alas!! and the result is
   [1] 0.4271211
 
 oh! no!!
 
 the result must be 0.5

And which part of the following did you fail to understand?

  For 'cov()', a non-Pearson method is unusual but available for
 the sake of completeness.  Note that 'spearman' basically
 computes 'cor(R(x), R(y))' (or 'cov(.,.)') where 'R(u) := rank(u,
 na.last=keep)'. Notice also that the ranking is (currently) done
 removing only cases that are missing on the variable itself,  which
 may not be what you expect if you let 'use' be 'complete.obs' or
 'pairwise.complete.obs'.

If you have improved code to contribute, you're welcome (notice that
this requires reranking for every pair of variables in an n x n
correlation matrix in the pairwise case), but there's really not much
point in reporting issues that are already known and documented.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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


[Rd] docu buglet

2005-02-13 Thread Kjetil Brinchmann Halvorsen
The help page groupGeneric {base}  refers (Math group)
the defunct |tetragamma|, |pentagamma while the newer
psigamma is not mentioned.
Kjetil
|
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Wishlist: simple legend options (PR#7400)

2005-02-13 Thread Gorjanc Gregor
Hello!

I was loooking in R-bugs and found under wishlist-fullfilled wish for 
smart placement of a legend. This has already been done in package
gplots in function smartlegend.

One question. This bug-report is under wishlist-fullfilled. Is it really
fullfilled? 

Mail from Elizabeth
---

It would be nice if legend had the option of some default locations you could
choose instead of entering specific coordinates, like topleft,
topright,topcenter, etc. based on par(usr) coordinates. I know I've wanted
it so often I've made my own simple non-robust wrap-around, so I don't have to
remember or parse the xjust and yjust options necessary to make it work. Of
course there should be the option of entering in your own coordinates. 

Also it would be nice to be able to put a optional title inside your legend.
Currently I just make my title the first value in my legend vector, and then fix
the other options so no symbols plot next to it. But this isn't always a pretty
result and can be a pain if your symbols are complicated.

Thanks,
Elizabeth 

Response to Elizabeth by Duncan Murdoch
---

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc at bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


[Rd] Wish: multiline comments

2005-02-13 Thread Gorjanc Gregor
Hello!

I found a wish for multilne comments under wishlist-fullfilled.

http://r-bugs.biostat.ku.dk/cgi-bin/R/wishlst-fulfilled?id=7261;expression=NA;user=guest

Is this really fullfilled? Where, in R 2.1.0? I was not able to 
find any announcements or talks about that on mailing list 
or NEWS files.

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc at bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


[Rd] corrupt data frame: columns will be truncated or padded with NAs in: format.data.frame(x, digits = digits)

2005-02-13 Thread Gorjanc Gregor
Hello!

I posted on saturday mail with the same subject on r-help seeking
for help in my work, but now I realized that this list is more 
appropriate for this. I think I found I bug. Bellow are comments
and reproducible examples:

# Create a data frame
(tmp - data.frame(y1=1:4, f1=factor(c(A, B, C, D
  y1 f1
1  1  A
2  2  B
3  3  C
4  4  D

# Add new column, which is not full (missing some data for last
# records)
tmp[1:2, y2] - 2
tmp
  y1 f1   y2
1  1  A2
2  2  B2
3  3  C NA
4  4  D NA
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs
in: format.data.frame(x, digits = digits) 

# Why did I get corrupted data frame? 

# Add new factor column, which is not full (missing some data for last
# records)
tmp[1:2, f2] - tmp[1:2, f1]
tmp
  y1 f1   y2   f2
1  1  A21
2  2  B22
3  3  C NA NA
4  4  D NA NA
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs 
in: format.data.frame(x, digits = digits) 

# New column should have class factor, but got somehow converted to integer
class(tmp$f2)
[1] integer

# If new column is completely full, everything is OK
 tmp$f3 - tmp$f1
 tmp
  y1 f1   y2   f2 f3
1  1  A21  A
2  2  B22  B
3  3  C NA NA  C
4  4  D NA NA  D
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs 
in: format.data.frame(x, digits = digits) 

# Let's go further and try to convert one of new numeric column 
# to factor
tmp$y2 - factor(tmp$y2, labels=x)
tmp
  y1 f1 y2   f2 f3
1  1  A  x1  A
2  2  B  x2  B
3  3  C  x NA  C
4  4  D  x NA  D
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs 
in: format.data.frame(x, digits = digits)

# Why did also NAs get converted to level x?

# Let's continue and add additional column, which is again not
# full, but missing some data for first records
tmp[3:4, y3] - 1
tmp
  y1 f1 y2   f2 f3 y3
1  1  A  x1  A NA
2  2  B  x2  B NA
3  3  C  x NA  C  1
4  4  D  x NA  D  1
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs
in: format.data.frame(x, digits = digits) 

# Notice the difference between NA in previous example and
# NA in current one.

# Try to convert this to factor
tmp$y3 - factor(tmp$y3, labels=y)
tmp
  y1 f1 y2   f2 f3   y3
1  1  A  x1  A NA
2  2  B  x2  B NA
3  3  C  x NA  Cy
4  4  D  x NA  Dy
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs 
in: format.data.frame(x, digits = digits)

# Works as expected.
# My configuration:
Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 2
 minor = 0.1
 year = 2004
 month = 11
 day = 15
 language = R

Windows XP Professional (build 2600) Service Pack 0.0

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc at bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


Re: [Rd] Wish: multiline comments

2005-02-13 Thread Prof Brian Ripley
Please look in the recent archives of this list: this was raised by Tony 
Rossini.

if(FALSE) {
}
already works.
On Mon, 14 Feb 2005, Gorjanc Gregor wrote:
Hello!
I found a wish for multilne comments under wishlist-fullfilled.
http://r-bugs.biostat.ku.dk/cgi-bin/R/wishlst-fulfilled?id=7261;expression=NA;user=guest
Is this really fullfilled? Where, in R 2.1.0? I was not able to
find any announcements or talks about that on mailing list
or NEWS files.
--
Lep pozdrav / With regards,
   Gregor GORJANC
---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc at bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

--
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
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Wishlist: simple legend options (PR#7400)

2005-02-13 Thread Uwe Ligges
Gorjanc Gregor wrote:
Hello!
I was loooking in R-bugs and found under wishlist-fullfilled wish for 
smart placement of a legend. This has already been done in package
gplots in function smartlegend.

One question. This bug-report is under wishlist-fullfilled. Is it really
fullfilled? 
Yes, in the current developer release (AKA R-devel, to be R-2.1.0), as 
you can easily see in the correpsonding NEWS file and the svn logs.

Why do you follow up into the bug repository?
Uwe Ligges

Mail from Elizabeth
---
It would be nice if legend had the option of some default locations you could
choose instead of entering specific coordinates, like topleft,
topright,topcenter, etc. based on par(usr) coordinates. I know I've wanted
it so often I've made my own simple non-robust wrap-around, so I don't have to
remember or parse the xjust and yjust options necessary to make it work. Of
course there should be the option of entering in your own coordinates. 

Also it would be nice to be able to put a optional title inside your legend.
Currently I just make my title the first value in my legend vector, and then fix
the other options so no symbols plot next to it. But this isn't always a pretty
result and can be a pain if your symbols are complicated.
Thanks,
Elizabeth 

Response to Elizabeth by Duncan Murdoch
---
--
Lep pozdrav / With regards,
Gregor GORJANC
---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc at bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel