Displaying 1 result from an estimated 1 matches for "xble".
Did you mean:
able
2005 Jul 05
1
Kind of 2 dim histogram - levelplot
...a function
that would do what I do by hand in "# fill data in bins"?
Here is the code:
# data
x <- c( 1.1, 1.5, 2.3, 2.5, 2.6, 2.9, 3.3, 3.5 )
y <- c( 6.3, 6.2, 5.9, 5.3, 5.4, 4.2, 4.8, 4.6 )
val <- c( 50, 58, 32, 14, 12, 17, 36, 52 )
# bins
xb <- 1:4
yb <- 4:7
xble <- length( xb ) - 1
yble <- length( yb ) - 1
# fill data in bins
g <- expand.grid( x=xb[1:xble], y=yb[1:yble] )
g$cnt <- numeric( dim( g )[1] )
g$avg <- numeric( dim( g )[1] )
g$proz <- numeric( dim( g )[1] )
idx <- 1
for (myy in 1:yble) {
for (myx in 1:xble) {
xIdx &l...