[R] Contingency tables example
jim holtman
jholtman at gmail.com
Thu Dec 29 18:28:09 CET 2011
Without giving help on a potential homework problem, I would suggest
that after each step you examine the object you are
creating/modifying. This is a basic debugging technique that will
help you out in the future. If you have a multi-step problem (as
almost all are), then you may have to go step-by-step and track down
when the problem is. It should be obvious where your problem is if
you follow these instructions.
On Thu, Dec 29, 2011 at 12:10 PM, David Winsemius
<dwinsemius at comcast.net> wrote:
>
> On Dec 29, 2011, at 7:15 AM, sambooth21 wrote:
>
>> I am having a few problems importing the data i'm running this code and
>> the
>> table sets up fine but all of the data values say NA:
>>
>> housdat<- c(21, 21, 28, 14, 19, 37, 34, 22, 36, 17, 23, 401, 10, 11, 36,
>> 3,
>> 5, 23, 61, 23, 17, 78, 46, 43, 43, 35, 40, 48, 45, 86, 26, 18, 54, 15, 25,
>> 62)
>> housdat<-array(dim=c(2,3,6))
>> dimnames(housdat) <- list(Housing=c("Tower Block","Apartment"),
>> Influence=c("Low","Medium","High"),
>> ContactSatisfaction=c("LCLow","LCMed","LCHigh","HCLow","HCMed","HCHigh"))
>>
>> ftable(housdat, row.vars=c("Housing","Influence"),
>> col.vars="ContactSatisfaction")
>>
>> any advice would be greatly appreciated!
>
>
> Rhelp is NOT a homework help list. If you are a student, as you give every
> appearance of being, then you should be seeking help through your usual
> academic channels. This dataset regarding Copenhageners' satisfaction with
> housing conditions from 30 or 40 years ago is widely copied in a variety of
> textbooks and websites, (including R's own MASS where its name is
> 'housing').
>
> --
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> ______________________________________________
> R-help at 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
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
More information about the R-help
mailing list