get frequency table of variable ‘Smoke’ of data set ‘survey’
##
## Heavy Never Occas Regul
## 11 189 19 17
Draw bar graph of variable ‘Smoke’ of data set ‘survey’
we can also use a compact expression
Sort in the order of frequency
barplot can produce barplot of any named vector as we created
## A1 A2 A3 A4 A5
## 10 20 30 40 60
Draw pie chart
or you can use a compact expression
##
## Heavy Never Occas Regul
## 11 189 19 17
##
## Heavy Never Occas Regul
## 4.641350 79.746835 8.016878 7.172996
find angles used in pie chart
##
## Heavy Never Occas Regul
## 16.70886 287.08861 28.86076 25.82278
draw histogram of variable ‘Pulse’ of data set ‘survey’
work with a vector of numbers
look at the results of hist function
## $breaks
## [1] 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110
##
## $counts
## [1] 2 0 4 2 14 21 37 27 38 14 18 6 7 2 0
##
## $density
## [1] 0.002083333 0.000000000 0.004166667 0.002083333 0.014583333 0.021875000
## [7] 0.038541667 0.028125000 0.039583333 0.014583333 0.018750000 0.006250000
## [13] 0.007291667 0.002083333 0.000000000
##
## $mids
## [1] 37.5 42.5 47.5 52.5 57.5 62.5 67.5 72.5 77.5 82.5 87.5 92.5
## [13] 97.5 102.5 107.5
##
## $xname
## [1] "survey$Pulse"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
draw culumative frequency
draw culumative relative frequency
Empirical distribution function computed with observations \(x_1,\ldots,x_n\) is defined as \[ \hat{F}(x) = \frac{\sum_{i=1}^n I(x_i\leq x)}{n} = \frac{\mbox{number of } x_i\leq x }{n} \] where, \(I()\) is the indicator function, equal to 1 if the condition in () is true and 0 otherwise.
##
## The decimal point is 1 digit(s) to the right of the |
##
## 3 | 5
## 4 | 0
## 4 | 88
## 5 | 004
## 5 | 569
## 6 | 000000000000122223444444444
## 6 | 555555666666788888888888888889
## 7 | 00000000000001122222222222222344444
## 7 | 5555566666666666668888999
## 8 | 0000000000000000001333344444
## 8 | 55556667788889
## 9 | 00000000222222
## 9 | 66678
## 10 | 0044