[Rd] socketConnection() + Ctrl-C + closeAllConnections() => core dump

2009-05-29 Thread Henrik Bengtsson
Doing the following in R v2.9.0 on Windows Vista core dumps R: 0. Rterm --vanilla 1. con <- socketConnection(port=6011); 2. User interrupt, i.e. Ctrl-C 3. closeAllConnections(); R crashes immediately after calling that last command. sessionInfo(): R version 2.9.0 Patched (2009-05-28 r48680) i38

[Rd] setdiff bizarre (was: odd behavior out of setdiff)

2009-05-29 Thread G. Jay Kerns
Dear R-devel, Please see the recent thread on R-help, "Odd Behavior Out of setdiff(...) - addition of duplicate entries is not identified" posted by Jason Rupert. I gave an answer, then read David Winsemius' answer, and then did some follow-up investigation. I would like to change my answer. My

Re: [Rd] png() error in recent R-devel on Windows

2009-05-29 Thread Duncan Murdoch
Thanks, will fix. Duncan Murdoch On 29/05/2009 7:32 PM, Hervé Pagès wrote: Hi, Tested with the latest r-devel snapshot build for Windows (2009-05-28 r48663): > png("test.png") Error in png("test.png") : invalid value of 'fillOddEven' The png() function is defined like this: > png function

[Rd] png() error in recent R-devel on Windows

2009-05-29 Thread Hervé Pagès
Hi, Tested with the latest r-devel snapshot build for Windows (2009-05-28 r48663): > png("test.png") Error in png("test.png") : invalid value of 'fillOddEven' The png() function is defined like this: > png function (filename = "Rplot%03d.png", width = 480, height = 480, units = "px", point

Re: [Rd] Why change data type when dropping to one-dimension?

2009-05-29 Thread Thomas Lumley
On Fri, 29 May 2009, Stavros Macrakis wrote: This is another example of the general preference of the designers of R for convenience over consistency. In my opinion, this is a design flaw even for non-programmers, because I find that inconsistencies make the system harder to learn. Yes, the na

Re: [Rd] Why change data type when dropping to one-dimension?

2009-05-29 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: > This is another example of the general preference of the designers of R for > convenience over consistency. > > In my opinion, this is a design flaw even for non-programmers, because I > find that inconsistencies make the system harder to learn. Yes, the naive > user may

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-29 Thread Wacek Kusnierczyk
Martin Maechler wrote: > Hi Waclav (and other interested parties), > > I have committed my working version of src/main/coerce.c > so you can prepare your patch against that. > Hi Martin, One quick reaction (which does not resolve my original complaint): you can have p non-const, and cast s to

Re: [Rd] Why change data type when dropping to one-dimension?

2009-05-29 Thread Jason Vertrees
Thomas Lumley wrote: > On Fri, 29 May 2009, Jason Vertrees wrote: > >> My question is: why does the paradigm of changing the type of a 1D >> return value to an unlisted array exist? This introduces boundary >> conditions where none need exist, thus making the coding harder and >> confusing. >> >>

Re: [Rd] Why change data type when dropping to one-dimension?

2009-05-29 Thread Stavros Macrakis
This is another example of the general preference of the designers of R for convenience over consistency. In my opinion, this is a design flaw even for non-programmers, because I find that inconsistencies make the system harder to learn. Yes, the naive user may stumble over the difference between

Re: [Rd] Why change data type when dropping to one-dimension?

2009-05-29 Thread Thomas Lumley
On Fri, 29 May 2009, Jason Vertrees wrote: My question is: why does the paradigm of changing the type of a 1D return value to an unlisted array exist? This introduces boundary conditions where none need exist, thus making the coding harder and confusing. For example, consider: > d = data.fram

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-29 Thread Martin Maechler
Hi Waclav (and other interested parties), I have committed my working version of src/main/coerce.c so you can prepare your patch against that. Thank you in advance! Martin On Fri, May 29, 2009 at 21:54, Wacek Kusnierczyk wrote: > Martin Maechler wrote: > > [...] >>     vQ> you return s, which s

[Rd] Why change data type when dropping to one-dimension?

2009-05-29 Thread Jason Vertrees
Hello, First, let me say I'm an avid fan of R--it's incredibly powerful and I use it all the time. I appreciate all the hard work that the many developers have undergone. My question is: why does the paradigm of changing the type of a 1D return value to an unlisted array exist? This introduces

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-29 Thread Wacek Kusnierczyk
Martin Maechler wrote: [...] > vQ> you return s, which should be the same pointer value (given the actual > vQ> code that does not modify the local variable s) with the same > pointed-to > vQ> string value (given the signature of the function). > > vQ> was perhaps > > vQ> char

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-29 Thread Wacek Kusnierczyk
Petr Savicky wrote: > On Fri, May 29, 2009 at 03:53:02PM +0200, Martin Maechler wrote: > >> my version of *using* the function was >> >> 1 SEXP attribute_hidden StringFromReal(double x, int *warn) >> 2 { >> 3 int w, d, e; >> 4 formatReal(&x, 1, &w, &d, &e, 0); >> 5 if (ISNA(x)) return NA_S

Re: [Rd] install.packages now intentionally references .Rprofile?

2009-05-29 Thread McGehee, Robert
I see that related to this thread, 'R CMD INSTALL' (like 'install.packages') also reads the .Rprofile before beginning. This caused package installation headaches for me that developers should be aware (as it was very difficult to debug). I added a setwd() to my .Rprofile [for example: setwd("/tmp

Re: [Rd] [R] custom sort?

2009-05-29 Thread Stavros Macrakis
Thanks for the quick fix! -s On Fri, May 29, 2009 at 1:02 PM, Duncan Murdoch wrote: > On 5/29/2009 9:28 AM, Duncan Murdoch wrote: > >> I've moved this to R-devel... >> >> On 5/28/2009 8:17 PM, Stavros Macrakis wrote: >> >>> I couldn't get your suggested method to work: >>> >>> `==.f

Re: [Rd] Bug in base function sample ( ) (PR#13727)

2009-05-29 Thread Stavros Macrakis
> > ...I discovered that when R attempts to sample from an object with only one > number it does not > reproduce/report the number but instead chooses a random number between 1 > and that number. > This is the documented behavior. In my opinion, it is a design error, but changing it would no doub

Re: [Rd] [R] custom sort?

2009-05-29 Thread Duncan Murdoch
On 5/29/2009 9:28 AM, Duncan Murdoch wrote: I've moved this to R-devel... On 5/28/2009 8:17 PM, Stavros Macrakis wrote: I couldn't get your suggested method to work: `==.foo` <- function(a,b) unclass(a)==unclass(b) `>.foo` <- function(a,b) unclass(a) < unclass(b) # invert comparison

Re: [Rd] 'mean' is not reverted in median() as NEWS says (PR#13731)

2009-05-29 Thread Peter Dalgaard
zheng...@mail.nih.gov wrote: Full_Name: Version: 2.9.0 OS: windows, linux Submission from: (NULL) (128.231.21.125) In NEWS, it says "median.default() was altered in 2.8.1 to use sum() rather than mean(), although it was still documented to use mean(). This caused problems for P

[Rd] 'mean' is not reverted in median() as NEWS says (PR#13731)

2009-05-29 Thread zhengxin
Full_Name: Version: 2.9.0 OS: windows, linux Submission from: (NULL) (128.231.21.125) In NEWS, it says "median.default() was altered in 2.8.1 to use sum() rather than mean(), although it was still documented to use mean(). This caused problems for POSIXt objects, for which mean()

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-29 Thread Petr Savicky
On Fri, May 29, 2009 at 03:53:02PM +0200, Martin Maechler wrote: > my version of *using* the function was > > 1 SEXP attribute_hidden StringFromReal(double x, int *warn) > 2 { > 3 int w, d, e; > 4 formatReal(&x, 1, &w, &d, &e, 0); > 5 if (ISNA(x)) return NA_STRING; > 6 else return mkChar(d

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-29 Thread Martin Maechler
> "vQ" == Wacek Kusnierczyk > on Thu, 28 May 2009 00:36:07 +0200 writes: vQ> Martin Maechler wrote: >> >> I have very slightly modified the changes (to get rid of -Wall >> warnings) and also exported the function as Rf_dropTrailing0(), >> and tested the result wi

Re: [Rd] [R] custom sort?

2009-05-29 Thread Duncan Murdoch
I've moved this to R-devel... On 5/28/2009 8:17 PM, Stavros Macrakis wrote: I couldn't get your suggested method to work: `==.foo` <- function(a,b) unclass(a)==unclass(b) `>.foo` <- function(a,b) unclass(a) < unclass(b) # invert comparison is.na.foo <- function(a)is.na(unclass(a))

Re: [Rd] edge case concerning NA in dim() (PR#13729)

2009-05-29 Thread Prof Brian Ripley
On Fri, 29 May 2009, asto...@esica.com wrote: Full_Name: Allan Stokes Version: 28.1 OS: XP Submission from: (NULL) (24.108.0.245) I'm trying to use package HDF5 and have discovered some round-trip errors: save, load, save is not idempotent. I started digging into the type system to figure out

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-29 Thread Martin Maechler
> "PS" == Petr Savicky > on Thu, 28 May 2009 09:36:48 +0200 writes: PS> On Wed, May 27, 2009 at 10:51:38PM +0200, Martin Maechler wrote: >> I have very slightly modified the changes (to get rid of -Wall >> warnings) and also exported the function as Rf_dropTrailing0(),

Re: [Rd] Bug in base function sample ( ) (PR#13727)

2009-05-29 Thread Gavin Simpson
On Thu, 2009-05-28 at 09:30 +0200, chajew...@fordham.edu wrote: > Full_Name: Michael Chajewski > Version: 2.9.0 > OS: Windows XP > Submission from: (NULL) (150.108.71.185) > > > I was programming a routine which kept reducing the array from which a random > sample was taken, resulting in a single

Re: [Rd] Fwd: [R] size of point symbols

2009-05-29 Thread baptiste auguie
Dear Prof. Ripley and all, Thank you very much for the pointers and the always insightful comments. I'd like to add a few further comments below for the sake of discussion, On 26 May 2009, at 08:35, Prof Brian Ripley wrote: I don't know where you get your claims from. R graphics is hand

[Rd] Bug in base function sample ( ) (PR#13727)

2009-05-29 Thread chajewski
Full_Name: Michael Chajewski Version: 2.9.0 OS: Windows XP Submission from: (NULL) (150.108.71.185) I was programming a routine which kept reducing the array from which a random sample was taken, resulting in a single number. I discovered that when R attempts to sample from an object with only on

[Rd] edge case concerning NA in dim() (PR#13729)

2009-05-29 Thread astokes
Full_Name: Allan Stokes Version: 28.1 OS: XP Submission from: (NULL) (24.108.0.245) I'm trying to use package HDF5 and have discovered some round-trip errors: save, load, save is not idempotent. I started digging into the type system to figure out what type graffiti is fouling this up. Soon I

[Rd] bug in strsplit?

2009-05-29 Thread Wacek Kusnierczyk
src/main/character.c:435-438 (do_strsplit) contains the following code: for (i = 0; i < tlen; i++) if (getCharCE(STRING_ELT(tok, 0)) == CE_UTF8) use_UTF8 = TRUE; for (i = 0; i < len; i++) if (getCharCE(STRING_ELT(x, 0)) == CE_UTF8) use_UTF8 = TRUE; since both loops iterate