[R] How to apply two parameter function in data frame

2012-03-06 Thread jon waterhouse
I know this is something simple that I cannot do because I do not yet think in R. I have a data frame has a variable participation (a factor), and several other factors. I want a chisq test (no contingency tables) for participation vs all of the other factors. In SPSS I would do: CROSSTABS

[R] Spacing of text does not match spacing of bars in barplot

2012-03-02 Thread jon waterhouse
I have a very standard barplot. My labels are too long to be printed horizontally under each bar, so I am using text to put the labels on a 45 degree slant. However, the labels are spaced more narrowly than the bars, so on an 8 vertical bar plot, the end of the eighth label is lined up with the

[R] barplots of several variables with different number of categories

2012-03-01 Thread jon waterhouse
If I have two factors, v1 and v2 and I want to have a stacked bar graph of the two variables side by side I could do barplot(cbind(table(v1),table(v2))) if v1 and v2 have the same number of categories. If they don't have the same number of categories this won't work. I'm sure there's a simple