[R] Plotting counts vs. intervals for a shingle

Walcerz, Douglas (APG) Douglas.Walcerz at cengage.com
Thu May 7 15:55:03 CEST 2009


Hello!

Suppose I have a set of values:

a <- c(1:10, 5:10)

Suppose I also have a set of intervals:

b <- cbind(c(0,2.5,4.5,6.5), c(5.5,7.5,9.5,11))

I can create a shingle that counts how many values are in each interval:

c <- shingle(a, b)

I can display the shingle to see the counts:

summary(c, showValues=FALSE)

The display looks like this:

Intervals:
  min  max count
1 0.0  5.5     6
2 2.5  7.5     8
3 4.5  9.5    10
4 6.5 11.0     8

Overlap between adjacent intervals:
[1] 4 6 6

I would like to plot the "count" vs. the "Intervals"

I can create a vector representing the intervals:

labels <- as.character(levels(c))

But I can't seem to create a vector of counts, which would permit me to plot counts vs. intervals.

Thanks for any insights you can provide.

p.s.  My real data contains 25,094 values and 5,809 intervals.  Many of the intervals will not contain any of the values.

-Douglas




More information about the R-help mailing list