friends

references:
- ISI, exploration 6.3, p.353

library(tidyverse)
library(knitr)

data

friends <- read.delim("CloseFriends.txt")
str(friends)
## 'data.frame':    1467 obs. of  2 variables:
##  $ Sex    : Factor w/ 2 levels "Men","Women": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Friends: int  0 0 0 0 0 0 0 0 0 0 ...
tbl <- friends %>%
  group_by(Sex) %>%
  summarize(mean = mean(Friends),
            s = sd(Friends),
            n = n())
kable(tbl)
Sex mean s n
Men 1.860856 1.777147 654
Women 2.088561 1.760130 813

Histograms.

ggplot(friends, aes(Friends)) +
  geom_histogram(color = "saddlebrown", fill = "wheat") +
  facet_grid(Sex ~ .) +
  labs(title = "Friends")