Libraries I use:
library(ggplot2)
library(dplyr)
library(statsr)
```{r}
factor_sc <- table(gss1$class, gss1$getahead)
factor_sc <- addmargins(factor_sc)
factor_sc
```
I write this and the output is:
Hard Work Both Equally Luck Or Help Other Sum
Lower Class 1063 368 299 0 1730
Working Class 10229 3221 1870 0 15320
Middle Class 9914 3624 1612 0 15150
Upper Class 701 265 100 0 1066
No Class 0 0 0 0 0
Sum 21907 7478 3881 0 33266
I want to run the chi-square inference on this data so that I want to remove Others and No class.
However, I already remove them using:
```{r}
gss1 <- gss %>% filter(!is.na(getahead),
!is.na(class), class != "No Class", getahead !="Other")
```
Why do Other
and No class
appear in my table?