Use "|" instead of "||". On Thu, Apr 3, 2008 at 6:27 PM, Farley, Robert <[EMAIL PROTECTED]> wrote: > I want to look at all the records making up a "row and column" of a > crosstab, but I'm not getting it right. I'm trying to use subset() but > my selection ((prod_act=="other") || (attr_act=="other")) gives my no > records. See the second table below. Getting just the row does work, > as seen in the third table. > > > > Why is this failing me? > > > > > > > .Table <- xtabs(~prod_act+attr_act, data=Dataset) ; .Table ; > remove(.Table) > > attr_act > > prod_act dk/rf home other school shop soc/rec university work > > dk/rf 52 0 0 0 0 0 0 0 > > home 0 12380 2826 552 1204 1054 2709 15842 > > other 0 0 703 1 62 48 42 227 > > school 0 0 7 187 4 11 0 8 > > shop 0 0 29 1 466 17 7 30 > > soc/rec 0 0 39 1 22 191 8 40 > > university 0 0 67 0 40 38 247 119 > > work 0 0 215 4 95 76 107 1581 > > > D2 <- subset(Dataset, ((prod_act=="other") || (attr_act=="other")) , > select=direction:attr_mta_taz ) > > > .Table <- xtabs(~prod_act+attr_act, data=D2) ; .Table ; > remove(.Table) > > attr_act > > prod_act dk/rf home other school shop soc/rec university work > > dk/rf 0 0 0 0 0 0 0 0 > > home 0 0 0 0 0 0 0 0 > > other 0 0 0 0 0 0 0 0 > > school 0 0 0 0 0 0 0 0 > > shop 0 0 0 0 0 0 0 0 > > soc/rec 0 0 0 0 0 0 0 0 > > university 0 0 0 0 0 0 0 0 > > work 0 0 0 0 0 0 0 0 > > > D3 <- subset(Dataset, (prod_act=="other") , > select=direction:attr_mta_taz ) > > > .Table <- xtabs(~prod_act+attr_act, data=D3) ; .Table ; > remove(.Table) > > attr_act > > prod_act dk/rf home other school shop soc/rec university work > > dk/rf 0 0 0 0 0 0 0 0 > > home 0 0 0 0 0 0 0 0 > > other 0 0 703 1 62 48 42 227 > > school 0 0 0 0 0 0 0 0 > > shop 0 0 0 0 0 0 0 0 > > soc/rec 0 0 0 0 0 0 0 0 > > university 0 0 0 0 0 0 0 0 > > work 0 0 0 0 0 0 0 0 > > > > > > > > > Robert Farley > > Metro > > 1 Gateway Plaza > > Mail Stop 99-23-7 > > Los Angeles, CA 90012-2952 > > Voice: (213)922-2532 > > Fax: (213)922-2868 > > www.Metro.net > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.