[R] denstrip package: densregion when density is not provided

Giorgio Garziano giorgio.garziano at ericsson.com
Sun Oct 4 13:44:38 CEST 2015


It is likely you have some list structure you should not.
Check the class of the elements of your matrixes, to see if any list class shows up.

Not clear from your code what is "y" passed to densregion(..).

Anyway, one way to reproduce your error is the following:

# this does not work
> a <- list(a=1:10, b=30:40)
> a
$a
[1]  1  2  3  4  5  6  7  8  9 10

$b
[1] 30 31 32 33 34 35 36 37 38 39 40

rank(a, ties.method = "min", na.last = "keep")

Error in rank(a, ties.method = "min", na.last = "keep") :
  unimplemented type 'list' in 'greater'

# this works
b <- sample(1:10)
> b
[1]  8  9  5  2  4  1  7 10  3  6
> rank(b)
[1]  8  9  5  2  4  1  7 10  3  6
>

You may also try to debug the densregion() function.
Using RStudio it pretty straightforward.
Call this before running your code.

debug(densregion)

when executing densregion() the RStudio source-viewer will show up the densregion.default code and
step by step (F10) you can go through the code lines see what is going wrong.

To stop debugging, click red Stop button on console pane and then if you do not need to re-run the debugging,
call:

undebug(densregion)


Good luck.

--
GG

	[[alternative HTML version deleted]]



More information about the R-help mailing list