How to proceed with chi square test in R if one line has zeros? I am trying to program with R. My categorical data is in a table of 5*5. However, the 5th line has only zeros. When I run the chi square test in a software program, it returns the result INVALID. But when I delete the 5th line and assume the table to be of size 4*5, the test works. 
How should I proceed?
 A: At first, you should state whether zeros in 5th row are:


*

*sampling zeros - occure by a sheer happenstance. If you would perform more sampling you'll get more observations in each cell and ultimately also in those cells in 5th row. 

*structural zeros - you won't ever get nonzero values in these cells, e.g. consider a contingency table desribing patients with several possible types of cancer. Let's assume rows are: Male 0-18 (Year old), Male 19-25, Male 26-40, Male 41-999 (so optimistic ;-) , probably for Methuselah),
Female 0-18, ...., Female 41-999. Columns denote cancer types.
So, as you probably spotted you won't ever get counts in any cell describing women at any age having prostate cancer. That are structural zeros.
By the way, the Chi Square approximation is invalid when counts are small, in which case I would recommend you Fisher's Exact Test. But even Fisher's Exact Test is NOT remedy for structural zeros. 
In the case of structural zeros you should try completly different approach, for example logit / loglinear model. You could find theory behind it in books by Alan Agresti (Categorical Data Analysis or Introduction to Categorical Data Analysis).
A: You don't have the data to run a 5X5 test.  My advice would be to run the 4X5 test and to be honest about the missing fifth row when writing up your results.
In my experience, this is something you mention briefly in the intro, in thre results section, and discuss in some detail in the "limitations and future research" section.
