11.4 Re-ording factors
library(ggplot2)
library(dplyr)
relig_summary <- gss_cat %>%
dplyr::group_by(relig) %>%
dplyr::summarize(
tvhours = mean(tvhours, na.rm = TRUE),
age = mean(age, na.rm = TRUE),
n = n()
)
relig_summary
## # A tibble: 15 x 4
## relig tvhours age n
## <fct> <dbl> <dbl> <int>
## 1 No answer 2.72 49.5 93
## 2 Don't know 4.62 35.9 15
## 3 Inter-nondenominational 2.87 40.0 109
## 4 Native american 3.46 38.9 23
## 5 Christian 2.79 40.1 689
## 6 Orthodox-christian 2.42 50.4 95
## 7 Moslem/islam 2.44 37.6 104
## 8 Other eastern 1.67 45.9 32
## 9 Hinduism 1.89 37.7 71
## 10 Buddhism 2.38 44.7 147
## 11 Other 2.73 41.0 224
## 12 None 2.71 41.2 3523
## 13 Jewish 2.52 52.4 388
## 14 Catholic 2.96 46.9 5124
## 15 Protestant 3.15 49.9 10846