Bug 14317 - Calling stripchart() with *first* level of grouping factor empty causes error
Calling stripchart() with *first* level of grouping factor empty causes error
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Graphics
R 2.12.0
ix86 (32-bit) Windows 32-bit
: P5 minor
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-13 22:07 UTC by pfehlers
Modified: 2014-02-16 11:43 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pfehlers 2010-06-13 22:07:51 UTC
# this works:
stripchart(decrease ~ treatment, data = OrchardSprays,
           subset = treatment != "B")

# this doesn't:
stripchart(decrease ~ treatment, data = OrchardSprays,
           subset = treatment != "A")

Evidently, stripchart() has a problem determining the range of data values in the following lines:

  dlim <- c(NA, NA)
  for(i in groups)
      dlim <- range(dlim, i[is.finite(i)], na.rm = TRUE)

In the testing I've done so far, replacing the above code with the following works:

  dlim <- range(unlist(groups), na.rm = TRUE)

or, possibly:

  u <- unlist(groups)
  dlim <- range(u[is.finite(u)], na.rm = TRUE)

(although it seems to me that na.rm=TRUE is superfluous.)

(I've checked r52265 CHANGES; nothing there re stripchart)

sessionInfo()
R version 2.12.0 Under development (unstable) (2010-05-31 r52164)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252   
[3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                   
[5] LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
Comment 1 Brian Ripley 2010-06-14 07:37:46 UTC
fixed in 2.11.1 patched
Comment 2 Jackie Rosen 2014-02-16 11:43:00 UTC
(spam comment removed)