Taka Matzmoto
2007-Jun-01 06:28 UTC
[R] 3 classification variables and one string variable
Dear R users I have 3 classification variables (string type) and one string variable in a data.frame (x). the first factor is a region (north, south, west, and east) (4 levels) the second factor is a market type (A, B, C, and D) (4 levels) the third factor is a item type (w, x, y, z) (4 levels) the string variable is a seller first name. My goal is to create a string vector consisting of seller first names for each cell of 4*4*4 contingency table. Some of the cells are empty. For example, w type ITEM in B market in North region = c("John", "Smith") I would like to create a name for the string vector using the three factor names (e.g., north.B.w) I tried to use table(). It didn't work well. I could use some long tedious method like below but it doesn't look good. north.B.w.ind <- x$region == "Noth" & x$market == "B" & x$item == "w" north.B.w <- x[north.B.w.ind, "name"] Any help will be appreciated. Thanks Taka, _________________________________________________________________ Office Live http://clk.atdmt.com/MRT/go/aub0540003042mrt/direct/01/