I've just started picking up R a few weeks ago. I'm having some problems trying to transmute (if this is the right R term?) the gender row to column.
> brfss %>%
+ filter(hours1 >=1,hours1 <=24) %>%
+ group_by(hours1, gender) %>%
+ summarise(count = n())
# A tibble: 48 x 3
# Groups: hours1 [?]
hours1 gender count
<int> <fctr> <int>
1 1 Male 96
2 1 Female 132
3 2 Male 464
4 2 Female 612
5 3 Male 1433
6 3 Female 2063
7 4 Male 5749
8 4 Female 8512
9 5 Male 13231
10 5 Female 20205
# ... with 38 more rows
I want to display the column as:
hours1 Male Female count
basically transmuting the whole Male/Female to column instead of rows. Can someone give me some pointers? thanks.