Chapter 7: Probability

7.1 Defining Probability

library(openintro) #load the package that contains the data
## Loading required package: airports
## Loading required package: cherryblossom
## Loading required package: usdata
help("email") # inspect the help file describing the data
## starting httpd help server ...
##  done
head(email) # inspect the first few rows of the data
## # A tibble: 6 × 21
##   spam  to_multiple from     cc sent_email time                image attach
##   <fct> <fct>       <fct> <int> <fct>      <dttm>              <dbl>  <dbl>
## 1 0     0           1         0 0          2012-01-01 14:16:41     0      0
## 2 0     0           1         0 0          2012-01-01 15:03:59     0      0
## 3 0     0           1         0 0          2012-01-02 00:00:32     0      0
## 4 0     0           1         0 0          2012-01-01 17:09:49     0      0
## 5 0     0           1         0 0          2012-01-01 18:00:01     0      0
## 6 0     0           1         0 0          2012-01-01 18:04:46     0      0
## # ℹ 13 more variables: dollar <dbl>, winner <fct>, inherit <dbl>, viagra <dbl>,
## #   password <dbl>, num_char <dbl>, line_breaks <int>, format <fct>,
## #   re_subj <fct>, exclaim_subj <dbl>, urgent_subj <fct>, exclaim_mess <dbl>,
## #   number <fct>
length(email$number)
## [1] 3921
table(email$number)
## 
##  none small   big 
##   549  2827   545