Meaning of Chi-squared test output I have an interaction table with plants species (column) and the number of time each plant has been found to live in each environment (row).
I'd like to know if there is a differential "preference" for plants species to live in different environment. I guess I should run a chi squared test. I'd need some help to make sense of the output.
The greatest is the residual, the biggest is the "preference" of one plant species to its environment. Is it correct?
The p.value gives the proportion of times that we would find such extreme pattern if all species would have no "preference" of environment. Is it correct?
What if I'd like to have such p.value for each plant species. Should I run a chi-squared test for each plant species independently? Or is there some kind of post-hoc test of the chi-squared test?
 A: I don't think you want chi-square at all. I think you want some form of count regression (possibly Poisson or negative binomial). You have a model
Number of plants ~ environment + species (maybe + interaction)
where both of the independent variables are categorical. The above model would allow you to see overall effects of environment and species as well as the effect at each level of each variable. 
A: Assuming a two-way table of species $\times$ environments, then so-called Pearson residuals can be defined for the frequencies in the table as $(\text{observed} - \text{expected}) / \sqrt{\text{expected}}$, which relate well to a chi-square test because the chi-square statistic is the sum of the squared Pearson residuals. You are perhaps more likely to get these residuals out of a model-fitting command, function or routine than one for cross-tabulation, but that depends on your software. From the definition of the residuals, large positive residuals indicate preference and large negative residuals indicate avoidance, relative to the expectation of no association. 
Otherwise: 


*

*It is difficult to know what you imagine a test for each species would look like. 

*Your interpretation of P-value is essentially right. 

*A more general framework for this analysis is loglinear (Poisson) modelling or some other flavour of count regression, as @Peter Flom points out. That allows more elaborate tests and would be needed to test more complicated hypotheses, especially those specifying interactions between species and environment. 
