Quantcast

unique(1:3,nmax=1) freezes R

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

unique(1:3,nmax=1) freezes R

Helske Jouni
Dear all,
I was playing around with factor contrasts, and found the argument nmax on function factor.  When using nmax=1, R froze completely, and I had to close it from task manager. After some debugging, I found that the problem is actually in unique-function, where the internal unique function is called:

.Internal(unique(x, incomparables, fromLast, nmax))

More generally, it looks like unique(x,nmax=k) freezes R the length of x is larger than 2 and k=1, and when nmax<length(x)-1 you get error "Error in unique.default(1:5, nmax = 3) : hash table is full".

Of course using nmax=1 doesn't make much sense, but maybe some check would be in place before calling internal unique?

Best regards,

Jouni Helske


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unique(1:3,nmax=1) freezes R

Joris FA Meys
I can reproduce this bug.

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Dutch_Belgium.1252  LC_CTYPE=Dutch_Belgium.1252
 LC_MONETARY=Dutch_Belgium.1252
[4] LC_NUMERIC=C                   LC_TIME=Dutch_Belgium.1252

attached base packages:
[1] grDevices datasets  splines   graphics  stats     tcltk     utils
methods   base

other attached packages:
[1] svSocket_0.9-55 TinnR_1.0-5     R2HTML_2.2.1    Hmisc_3.12-2
 Formula_1.1-1
[6] survival_2.37-4

loaded via a namespace (and not attached):
[1] cluster_1.14.4  fortunes_1.5-0  grid_3.0.1      lattice_0.20-23
rpart_4.1-3
[6] svMisc_0.9-69   tools_3.0.1


On Wed, Oct 30, 2013 at 9:05 AM, Helske Jouni <[hidden email]> wrote:

> Dear all,
> I was playing around with factor contrasts, and found the argument nmax on
> function factor.  When using nmax=1, R froze completely, and I had to close
> it from task manager. After some debugging, I found that the problem is
> actually in unique-function, where the internal unique function is called:
>
> .Internal(unique(x, incomparables, fromLast, nmax))
>
> More generally, it looks like unique(x,nmax=k) freezes R the length of x
> is larger than 2 and k=1, and when nmax<length(x)-1 you get error "Error in
> unique.default(1:5, nmax = 3) : hash table is full".
>
> Of course using nmax=1 doesn't make much sense, but maybe some check would
> be in place before calling internal unique?
>
> Best regards,
>
> Jouni Helske
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



--
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel : +32 9 264 59 87
[hidden email]
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Loading...