Hi All,

I have a 4-dimensional data. I'm using barchart() function from lattice
package. The R code and data are below - code includes one for stack=TRUE
and other for stack=FALSE.

I would like to present the data in another form which would be plotting
Factor3 levels (P, Q, R, S) as two stacked bars (side by side). Like, for
each level of Factor1 there should be two bars: first bar showing stacked
values of "P" and "Q" and the adjacent bar showing stacked values of "R" and
"S". Is it possible using barchart() function?

OR, if someone can give me some suggestions on the best way to present
such data. Any help would be highly appreciated.

# Reading data in object "foo"

barchart(foo$Value ~ foo$Factor1 | foo$Factor2, data = foo,
         groups = foo$Factor3, stack = TRUE,
         auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"))
barchart(foo$Value ~ foo$Factor1 | foo$Factor2, data = foo,
         groups = foo$Factor3, stack = FALSE,
         auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"))

# Data

Factor1    Factor2    Factor3    Value
A    X    P    10
A    X    Q    20
A    X    R    10
A    X    S    20
A    Y    P    20
A    Y    Q    5
A    Y    R    20
A    Y    S    5
B    X    P  20
B    X    Q    10
B    X    R    20
B    X    S    10
B    Y    P    30
B    Y    Q    50
B    Y    R    30
B    Y    S    50
Thanks,
~Xin

	[[alternative HTML version deleted]]


