Hi, I get an error when I use bagplot from the package aplpack. Any ideas what theproblem is with the data set? library("aplpack") x <- c(5, 2, 1, 6, 3, 5, 4, 7, 4, 4, 3, 4, 5, 4, 6, 3, 3) y <- c(2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 1, 14, 17, 18, 19, 20, 22) bagplot(y,x) # works bagplot(x,y) # Error in pg[segm.no, 2] : (subscript) boolean index too long Thanks Sigbert -- https://hu.berlin/sk https://www.stat.de/faqs https://hu.berlin/mmstat https://hu.berlin/mmstat-int https://hu.berlin/mmstat-ar
Hi Sigbert, I have never used the aplpack package but out of curiosity I tried it out. Doing a scatter plot of your (x,y) data shows that there are many repeated x values, and this seems to be the source of the error. There are no repeated y values. It seems that the bagplot() function does not handle repeated x-values. I tried adding some noise to the x-values and that worked fine. x2 <- x + rnorm(length(x),0,1.e-5) bagplot(x2,y) HTH, Eric On Wed, Sep 21, 2022 at 12:54 PM Sigbert Klinke <sigbert at wiwi.hu-berlin.de> wrote:> Hi, > > I get an error when I use bagplot from the package aplpack. Any ideas > what theproblem is with the data set? > > library("aplpack") > > x <- c(5, 2, 1, 6, 3, 5, 4, 7, 4, 4, 3, 4, 5, 4, 6, 3, 3) > > y <- c(2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 1, 14, 17, 18, 19, 20, 22) > > bagplot(y,x) # works > > bagplot(x,y) # Error in pg[segm.no, 2] : (subscript) boolean index too > long > > Thanks Sigbert > > -- > https://hu.berlin/sk > https://www.stat.de/faqs > https://hu.berlin/mmstat > https://hu.berlin/mmstat-int > https://hu.berlin/mmstat-ar > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
[re-sending as plain text] Hi Sigbert, I have never used the aplpack package but out of curiosity I tried it out. Doing a scatter plot of your (x,y) data shows that there are many repeated x values, and this seems to be the source of the error. There are no repeated y values. It seems that the bagplot() function does not handle repeated x-values. I tried adding some noise to the x-values and that worked fine. x2 <- x + rnorm(length(x),0,1.e-5) bagplot(x2,y) HTH, Eric On Wed, Sep 21, 2022 at 12:54 PM Sigbert Klinke <sigbert at wiwi.hu-berlin.de> wrote:> > Hi, > > I get an error when I use bagplot from the package aplpack. Any ideas > what theproblem is with the data set? > > library("aplpack") > > x <- c(5, 2, 1, 6, 3, 5, 4, 7, 4, 4, 3, 4, 5, 4, 6, 3, 3) > > y <- c(2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 1, 14, 17, 18, 19, 20, 22) > > bagplot(y,x) # works > > bagplot(x,y) # Error in pg[segm.no, 2] : (subscript) boolean index too long > > Thanks Sigbert > > -- > https://hu.berlin/sk > https://www.stat.de/faqs > https://hu.berlin/mmstat > https://hu.berlin/mmstat-int > https://hu.berlin/mmstat-ar > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.