Re: [Rd] match function causing bad performance when using tablefunction on factors with multibyte characters on Windows

2011-01-25 Thread Matthew Dowle
Thanks Simon! I can reproduce this on Linux now, too. locale -a didn't show en_US.iso88591 for me so I needed 'sudo locale-gen en_US' first. Then running R with $ LANG="en_US.ISO-8859-1" R is enough to reproduce the problem. Karl - can you use tabulate instead as Simon suggests? Matthew -- V

[Rd] patch dendrogram.R from stats [was: Re: dendrogram plot does not draw long labels ?]

2011-01-25 Thread Tobias Verbeke
L.S. Please find below a patch for dendrogram.R (stats package) against revision r54107 which allows one to pass the xpd parameter as a component of the nodePar list (to be passed to plot.dendrogram). I hope I did not overlook anything. Best, Tobias 378a379 > lab.xpd <- Xtract("xpd", nPar,

Re: [Rd] match function causing bad performance when using tablefunction on factors with multibyte characters on Windows

2011-01-25 Thread Simon Urbanek
On Jan 25, 2011, at 5:49 AM, Karl Ove Hufthammer wrote: > Matthew Dowle wrote: > >> I'm not sure, but note the difference in locale between >> Linux (UTF-8) and Windows (non UTF-8). As far as I >> understand it R much prefers UTF-8, which Windows doesn't >> natively support. Otherwise you could

[Rd] Regression in error handling with R >= 2.12

2011-01-25 Thread Hervé Pagès
Hi list, When nesting 2 function calls, if an exception occurs during the inner call, the error message will display properly: bar <- function() stop("bar() is broken") foo <- function(x) {x * (x - 2)} > foo(bar()) Error in bar() : bar() is broken However, starting with R 2.12, if fo

Re: [Rd] match function causing bad performance when usingtablefunction on factors with multibyte characters on Windows

2011-01-25 Thread Matthew Dowle
I don't know if that's enough to flip the UTF8 switches internally in R. If it is enough, then this result may show I'm barking up the wrong tree. Hopefully someone from core is watching who knows. Is it feasible that you run R using an alias, and for some reason the alias is not picking up your s

Re: [Rd] NA printing

2011-01-25 Thread Marc Schwartz
On Jan 25, 2011, at 9:34 AM, Robin Hankin wrote: > Hi. > > I'm writing a print method for an object that includes a numeric matrix > for which > the lower diagonal elements are not meaningful. So I make the lower > diagonal of my matrix NA and print it. > > But my co-author does not like NA the

[Rd] NA printing

2011-01-25 Thread Robin Hankin
Hi. I'm writing a print method for an object that includes a numeric matrix for which the lower diagonal elements are not meaningful. So I make the lower diagonal of my matrix NA and print it. But my co-author does not like NA there and wants a dash. I have tried coercing the matrix to characte

Re: [Rd] dendrogram plot does not draw long labels ?

2011-01-25 Thread Karl Forner
Hi Tobias and thank you for your reply, Using your insight I managed to work-around the issue (with some help) by increasing the "mai" option of par(). For example a "mai" with first coordinate (bottom) set to 5 allows to display ~ 42 letters. We tried to change the xpd value in the text() call t

Re: [Rd] match function causing bad performance when using tablefunction on factors with multibyte characters on Windows

2011-01-25 Thread Karl Ove Hufthammer
Matthew Dowle wrote: > I'm not sure, but note the difference in locale between > Linux (UTF-8) and Windows (non UTF-8). As far as I > understand it R much prefers UTF-8, which Windows doesn't > natively support. Otherwise you could just change your > Windows locale to a UTF-8 locale to make R happ

Re: [Rd] dendrogram plot does not draw long labels ?

2011-01-25 Thread Tobias Verbeke
Hi Karl, On 01/25/2011 11:27 AM, Karl Forner wrote: It seems that the plot function for dendrograms does not draw labels when they are too long. hc<- hclust(dist(USArrests), "ave") dend1<- as.dendrogram(hc) dend2<- cut(dend1, h=70) dd<- dend2$lower[[1]] plot(dd) # first label is drawn attr(dd

Re: [Rd] Missing argument vs. empty argument

2011-01-25 Thread Renaud Gaujoux
My purpose is indeed to write a '[' method. I will go for the `[.data.frame` solution then. Thank you. On 25/01/2011 12:53, Prof Brian Ripley wrote: On Tue, 25 Jan 2011, Renaud Gaujoux wrote: Hi, is there an easy, robust, and/or recommended way to distinguish a missing argument from an empt

Re: [Rd] Missing argument vs. empty argument

2011-01-25 Thread Prof Brian Ripley
On Tue, 25 Jan 2011, Renaud Gaujoux wrote: Hi, is there an easy, robust, and/or recommended way to distinguish a missing argument from an empty argument as in: An empty argument is a missing argument when argument matching is done, e.g. foo <- function(i,j) match.call() foo(i) foo(i = i

[Rd] dendrogram plot does not draw long labels ?

2011-01-25 Thread Karl Forner
Hello, It seems that the plot function for dendrograms does not draw labels when they are too long. > hc <- hclust(dist(USArrests), "ave") > dend1 <- as.dendrogram(hc) > dend2 <- cut(dend1, h=70) > dd <- dend2$lower[[1]] > plot(dd) # first label is drawn > attr(dd[[1]], "label") <- "a

[Rd] Missing argument vs. empty argument

2011-01-25 Thread Renaud Gaujoux
Hi, is there an easy, robust, and/or recommended way to distinguish a missing argument from an empty argument as in: foo <- function(i, j){ print(missing(j)) print(nargs()) } foo(i) # TRUE, 1 foo(i,) # TRUE, 2 I know I can work around with nargs, the list of arguments and the names