The main aim of the task is to import data into R, perform brief explanatory analysis, build at least one plot

Export data using R Markdown and ‘knit’ by creating an html.file

1. Go to https://andmed.stat.ee/en/stat and create a data set you want to explore. Import the data into R.

#installing the required packages

#install.packages(“stats”)

#install.packages(“dplyr”)

#Importing and storing the dataset in mydata

#Loading the required libraries (library function helps to invoke the content of the packages)

library(stats)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Importing my dataset()

Data analysis and graph plotting will cover between 2008 and 2010.

mydata<-read.csv("C:/Users/oladayo/Desktop/School Work/My R Project/Abimbola/test.csv")
mydata
##                           Type.of.broadcast
## 1  Broadcasts total (excluding advertising)
## 2                          ..own production
## 3                    ..repeat transmissions
## 4                 ..broadcasts for children
## 5                    ..broadcasts for youth
## 6                                      News
## 7                    Informative broadcasts
## 8                    Educational broadcasts
## 9              Broadcasts of human interest
## 10       Cultural and scientific broadcasts
## 11                     Religious broadcasts
## 12                         Music broadcasts
## 13                        Sports broadcasts
## 14                           ..competitions
## 15                             Infotainment
## 16                            Entertainment
## 17                               ..TV-games
## 18                        ..TV-competitions
## 19                                  Fiction
## 20              ..full-length feature films
## 21                    ..TV-plays and series
## 22                     ..animation cartoons
## 23                              ..telefilms
## 24  ..transmissions of theatre performances
## 25                         Other broadcasts
##    X2008.Duration.of.broadcasts..minutes X2008.Share.of.broadcasts...
## 1                                    880                        100.0
## 2                                    381                         43.3
## 3                                    305                         34.7
## 4                                     40                          4.5
## 5                                    135                         15.4
## 6                                     84                          9.6
## 7                                     35                          4.0
## 8                                      4                          0.5
## 9                                     71                          8.1
## 10                                    23                          2.6
## 11                                     1                          0.1
## 12                                   137                         15.5
## 13                                    89                         10.1
## 14                                    69                          7.9
## 15                                    20                          2.3
## 16                                    95                         10.8
## 17                                     3                          0.4
## 18                                     3                          0.4
## 19                                   308                         35.0
## 20                                   101                         11.4
## 21                                   137                         15.6
## 22                                    27                          3.1
## 23                                    13                          1.5
## 24                                     1                          0.1
## 25                                    12                          1.4
##    X2009.Duration.of.broadcasts..minutes X2009.Share.of.broadcasts...
## 1                                    939                        100.0
## 2                                    411                         43.8
## 3                                    342                         36.4
## 4                                     34                          3.6
## 5                                     45                          4.8
## 6                                     58                          6.2
## 7                                     23                          2.4
## 8                                      7                          0.7
## 9                                     63                          6.7
## 10                                    17                          1.8
## 11                                     1                          0.1
## 12                                   237                         25.2
## 13                                    17                          1.8
## 14                                    11                          1.2
## 15                                    28                          3.0
## 16                                   103                         11.0
## 17                                     2                          0.2
## 18                                     4                          0.4
## 19                                   372                         39.6
## 20                                   112                         11.9
## 21                                   186                         19.8
## 22                                    31                          3.3
## 23                                    15                          1.6
## 24                                     2                          0.2
## 25                                    13                          1.4
##    X2010.Duration.of.broadcasts..minutes X2010.Share.of.broadcasts...
## 1                                    921                        100.0
## 2                                    312                         33.9
## 3                                    356                         38.6
## 4                                     31                          3.4
## 5                                     56                          6.1
## 6                                     62                          6.7
## 7                                     24                          2.6
## 8                                      6                          0.7
## 9                                     68                          7.3
## 10                                    20                          2.2
## 11                                     1                          0.2
## 12                                   235                         25.5
## 13                                    21                          2.3
## 14                                    16                          1.7
## 15                                    20                          2.2
## 16                                    92                         10.0
## 17                                     2                          0.2
## 18                                     4                          0.5
## 19                                   354                         38.4
## 20                                   102                         11.1
## 21                                   184                         20.0
## 22                                    24                          2.6
## 23                                    13                          1.4
## 24                                     2                          0.2
## 25                                    11                          1.1
##    X2011.Duration.of.broadcasts..minutes X2011.Share.of.broadcasts...
## 1                                    889                        100.0
## 2                                    253                         28.5
## 3                                    532                         59.8
## 4                                     32                          3.6
## 5                                     38                          4.2
## 6                                     68                          7.7
## 7                                     27                          3.1
## 8                                      8                          0.9
## 9                                     79                          8.9
## 10                                    34                          3.8
## 11                                     4                          0.4
## 12                                   120                         13.4
## 13                                    23                          2.6
## 14                                    11                          1.3
## 15                                    38                          4.2
## 16                                   110                         12.4
## 17                                     2                          0.2
## 18                                     3                          0.3
## 19                                   368                         41.4
## 20                                   102                         11.5
## 21                                   174                         19.5
## 22                                    34                          3.8
## 23                                    25                          2.8
## 24                                     2                          0.2
## 25                                    10                          1.2
##    X2012.Duration.of.broadcasts..minutes X2012.Share.of.broadcasts...
## 1                                    943                        100.0
## 2                                    254                         28.6
## 3                                    526                         59.1
## 4                                     33                          3.7
## 5                                     38                          4.3
## 6                                     86                          9.6
## 7                                     30                          3.3
## 8                                      9                          1.0
## 9                                    105                         11.8
## 10                                    33                          3.7
## 11                                     5                          0.6
## 12                                   121                         13.6
## 13                                    21                          2.4
## 14                                    12                          1.3
## 15                                    28                          3.1
## 16                                   105                         11.8
## 17                                     5                          0.6
## 18                                     3                          0.4
## 19                                   383                         43.1
## 20                                   101                         11.3
## 21                                   195                         22.0
## 22                                    35                          3.9
## 23                                    29                          3.2
## 24                                     2                          0.2
## 25                                    18                          2.0
##    X2013.Duration.of.broadcasts..minutes X2013.Share.of.broadcasts...
## 1                                    953                        100.0
## 2                                    271                         28.4
## 3                                    450                         47.2
## 4                                     91                          9.5
## 5                                     31                          3.3
## 6                                     78                          8.2
## 7                                     42                          4.4
## 8                                      6                          0.6
## 9                                    101                         10.6
## 10                                    32                          3.4
## 11                                     4                          0.4
## 12                                   130                         13.6
## 13                                    17                          1.8
## 14                                    10                          1.0
## 15                                    21                          2.2
## 16                                    98                         10.3
## 17                                     4                          0.4
## 18                                     5                          0.5
## 19                                   419                         44.0
## 20                                    99                         10.4
## 21                                   178                         18.7
## 22                                    94                          9.9
## 23                                    22                          2.3
## 24                                     2                          0.2
## 25                                     4                          0.4
##    X2014.Duration.of.broadcasts..minutes X2014.Share.of.broadcasts...
## 1                                    968                        100.0
## 2                                    261                         27.0
## 3                                    452                         46.7
## 4                                    105                         10.8
## 5                                     37                          3.8
## 6                                     78                          8.1
## 7                                     38                          3.9
## 8                                     13                          1.3
## 9                                     78                          8.1
## 10                                    17                          1.8
## 11                                     3                          0.3
## 12                                   121                         12.5
## 13                                    22                          2.3
## 14                                    14                          1.4
## 15                                    25                          2.6
## 16                                   102                         10.5
## 17                                     2                          0.2
## 18                                     7                          0.7
## 19                                   452                         46.7
## 20                                   118                         12.2
## 21                                   174                         18.0
## 22                                   114                         11.8
## 23                                    19                          2.0
## 24                                     2                          0.2
## 25                                    18                          1.9
##    X2015.Duration.of.broadcasts..minutes X2015.Share.of.broadcasts...
## 1                                    907                        100.0
## 2                                    170                         18.7
## 3                                    400                         44.1
## 4                                     97                         10.7
## 5                                     63                          6.9
## 6                                     53                          5.8
## 7                                     19                          2.1
## 8                                      2                          0.2
## 9                                     55                          6.1
## 10                                    14                          1.5
## 11                                     0                          0.0
## 12                                   107                         11.8
## 13                                    18                          2.0
## 14                                    15                          1.7
## 15                                    23                          2.5
## 16                                    92                         10.1
## 17                                     2                          0.2
## 18                                     7                          0.8
## 19                                   521                         57.4
## 20                                   209                         23.0
## 21                                   161                         17.8
## 22                                   105                         11.6
## 23                                    15                          1.7
## 24                                     0                          0.0
## 25                                     4                          0.4
##    X2016.Duration.of.broadcasts..minutes X2016.Share.of.broadcasts...
## 1                                   1038                        100.0
## 2                                    311                         30.0
## 3                                    428                         41.2
## 4                                    118                         11.4
## 5                                     29                          2.8
## 6                                     82                          7.9
## 7                                     23                          2.2
## 8                                      1                          0.1
## 9                                     72                          6.9
## 10                                    12                          1.2
## 11                                     0                          0.0
## 12                                   172                         16.6
## 13                                    19                          1.8
## 14                                    15                          1.4
## 15                                    21                          2.0
## 16                                    74                          7.1
## 17                                     1                          0.1
## 18                                     4                          0.4
## 19                                   546                         52.6
## 20                                   259                         25.0
## 21                                   148                         14.3
## 22                                   118                         11.4
## 23                                    10                          1.0
## 24                                     1                          0.1
## 25                                    15                          1.4
##    X2017.Duration.of.broadcasts..minutes X2017.Share.of.broadcasts...
## 1                                   1063                        100.0
## 2                                    439                         41.3
## 3                                    395                         37.2
## 4                                    127                         11.9
## 5                                     30                          2.8
## 6                                    105                          9.9
## 7                                     43                          4.0
## 8                                      1                          0.1
## 9                                     54                          5.1
## 10                                    11                          1.0
## 11                                     0                          0.0
## 12                                   172                         16.2
## 13                                    23                          2.2
## 14                                    12                          1.1
## 15                                    28                          2.6
## 16                                    90                          8.5
## 17                                     0                          0.0
## 18                                     2                          0.2
## 19                                   526                         49.5
## 20                                   228                         21.4
## 21                                    95                          8.9
## 22                                   182                         17.1
## 23                                    13                          1.2
## 24                                     0                          0.0
## 25                                    10                          0.9
##    X2018.Duration.of.broadcasts..minutes X2018.Share.of.broadcasts...
## 1                                   1080                        100.0
## 2                                    415                         38.4
## 3                                    333                         30.8
## 4                                    150                         13.9
## 5                                     61                          5.6
## 6                                     50                          4.6
## 7                                     47                          4.4
## 8                                     46                          4.3
## 9                                     34                          3.1
## 10                                    15                          1.4
## 11                                     0                          0.0
## 12                                   152                         14.1
## 13                                    26                          2.4
## 14                                    24                          2.2
## 15                                    25                          2.3
## 16                                   114                         10.6
## 17                                    22                          2.0
## 18                                     4                          0.4
## 19                                   555                         51.4
## 20                                   193                         17.9
## 21                                   105                          9.7
## 22                                   163                         15.1
## 23                                    11                          1.0
## 24                                     0                          0.0
## 25                                    16                          1.5
##    X2019.Duration.of.broadcasts..minutes X2019.Share.of.broadcasts...
## 1                                   1180                        100.0
## 2                                    352                         29.8
## 3                                    357                         30.3
## 4                                    166                         14.1
## 5                                     49                          4.2
## 6                                     57                          4.8
## 7                                     51                          4.3
## 8                                      2                          0.2
## 9                                     70                          5.9
## 10                                    15                          1.3
## 11                                     0                          0.0
## 12                                   150                         12.7
## 13                                    16                          1.4
## 14                                    15                          1.3
## 15                                    31                          2.6
## 16                                   113                          9.6
## 17                                     0                          0.0
## 18                                     3                          0.3
## 19                                   660                         55.9
## 20                                   208                         17.6
## 21                                   167                         14.2
## 22                                   166                         14.1
## 23                                    18                          1.5
## 24                                     0                          0.0
## 25                                    14                          1.2
##    X2020.Duration.of.broadcasts..minutes X2020.Share.of.broadcasts...
## 1                                   1147                        100.0
## 2                                    248                         21.6
## 3                                    467                         40.7
## 4                                    152                         13.3
## 5                                     47                          4.1
## 6                                     48                          4.2
## 7                                    101                          8.8
## 8                                      1                          0.1
## 9                                     35                          3.1
## 10                                    12                          1.0
## 11                                     0                          0.0
## 12                                   247                         21.5
## 13                                    13                          1.1
## 14                                     6                          0.5
## 15                                    48                          4.2
## 16                                   116                         10.1
## 17                                     0                          0.0
## 18                                     3                          0.3
## 19                                   481                         41.9
## 20                                   178                         15.5
## 21                                   121                         10.5
## 22                                   115                         10.0
## 23                                     5                          0.4
## 24                                     0                          0.0
## 25                                    45                          3.9
##    X2021.Duration.of.broadcasts..minutes X2021.Share.of.broadcasts...
## 1                                   1139                        100.0
## 2                                    197                         17.3
## 3                                    355                         31.2
## 4                                    168                         14.7
## 5                                     41                          3.6
## 6                                     43                          3.8
## 7                                     63                          5.5
## 8                                      1                          0.1
## 9                                     28                          2.5
## 10                                     9                          0.8
## 11                                     0                          0.0
## 12                                   180                         15.8
## 13                                    80                          7.0
## 14                                    12                          1.1
## 15                                    42                          3.7
## 16                                    91                          8.0
## 17                                     0                          0.0
## 18                                     2                          0.2
## 19                                   536                         47.1
## 20                                   175                         15.4
## 21                                   174                         15.3
## 22                                   100                          8.8
## 23                                     5                          0.4
## 24                                     0                          0.0
## 25                                    68                          6.0

#To evaluate the structure of the data

str(mydata)
## 'data.frame':    25 obs. of  29 variables:
##  $ Type.of.broadcast                    : chr  "Broadcasts total (excluding advertising)" "..own production" "..repeat transmissions" "..broadcasts for children" ...
##  $ X2008.Duration.of.broadcasts..minutes: int  880 381 305 40 135 84 35 4 71 23 ...
##  $ X2008.Share.of.broadcasts...         : num  100 43.3 34.7 4.5 15.4 9.6 4 0.5 8.1 2.6 ...
##  $ X2009.Duration.of.broadcasts..minutes: int  939 411 342 34 45 58 23 7 63 17 ...
##  $ X2009.Share.of.broadcasts...         : num  100 43.8 36.4 3.6 4.8 6.2 2.4 0.7 6.7 1.8 ...
##  $ X2010.Duration.of.broadcasts..minutes: int  921 312 356 31 56 62 24 6 68 20 ...
##  $ X2010.Share.of.broadcasts...         : num  100 33.9 38.6 3.4 6.1 6.7 2.6 0.7 7.3 2.2 ...
##  $ X2011.Duration.of.broadcasts..minutes: int  889 253 532 32 38 68 27 8 79 34 ...
##  $ X2011.Share.of.broadcasts...         : num  100 28.5 59.8 3.6 4.2 7.7 3.1 0.9 8.9 3.8 ...
##  $ X2012.Duration.of.broadcasts..minutes: int  943 254 526 33 38 86 30 9 105 33 ...
##  $ X2012.Share.of.broadcasts...         : num  100 28.6 59.1 3.7 4.3 9.6 3.3 1 11.8 3.7 ...
##  $ X2013.Duration.of.broadcasts..minutes: int  953 271 450 91 31 78 42 6 101 32 ...
##  $ X2013.Share.of.broadcasts...         : num  100 28.4 47.2 9.5 3.3 8.2 4.4 0.6 10.6 3.4 ...
##  $ X2014.Duration.of.broadcasts..minutes: int  968 261 452 105 37 78 38 13 78 17 ...
##  $ X2014.Share.of.broadcasts...         : num  100 27 46.7 10.8 3.8 8.1 3.9 1.3 8.1 1.8 ...
##  $ X2015.Duration.of.broadcasts..minutes: int  907 170 400 97 63 53 19 2 55 14 ...
##  $ X2015.Share.of.broadcasts...         : num  100 18.7 44.1 10.7 6.9 5.8 2.1 0.2 6.1 1.5 ...
##  $ X2016.Duration.of.broadcasts..minutes: int  1038 311 428 118 29 82 23 1 72 12 ...
##  $ X2016.Share.of.broadcasts...         : num  100 30 41.2 11.4 2.8 7.9 2.2 0.1 6.9 1.2 ...
##  $ X2017.Duration.of.broadcasts..minutes: int  1063 439 395 127 30 105 43 1 54 11 ...
##  $ X2017.Share.of.broadcasts...         : num  100 41.3 37.2 11.9 2.8 9.9 4 0.1 5.1 1 ...
##  $ X2018.Duration.of.broadcasts..minutes: int  1080 415 333 150 61 50 47 46 34 15 ...
##  $ X2018.Share.of.broadcasts...         : num  100 38.4 30.8 13.9 5.6 4.6 4.4 4.3 3.1 1.4 ...
##  $ X2019.Duration.of.broadcasts..minutes: int  1180 352 357 166 49 57 51 2 70 15 ...
##  $ X2019.Share.of.broadcasts...         : num  100 29.8 30.3 14.1 4.2 4.8 4.3 0.2 5.9 1.3 ...
##  $ X2020.Duration.of.broadcasts..minutes: int  1147 248 467 152 47 48 101 1 35 12 ...
##  $ X2020.Share.of.broadcasts...         : num  100 21.6 40.7 13.3 4.1 4.2 8.8 0.1 3.1 1 ...
##  $ X2021.Duration.of.broadcasts..minutes: int  1139 197 355 168 41 43 63 1 28 9 ...
##  $ X2021.Share.of.broadcasts...         : num  100 17.3 31.2 14.7 3.6 3.8 5.5 0.1 2.5 0.8 ...

2. Prepare EDA (Explanatory Data Analysis). Write at least 5 questions and provide your answers during the first stage of EDA.

Data summarization

#Preparing a dataset for the Duration of broadcasts and Share of broadcasts for 2008

Db2008 = mydata$X2008.Duration.of.broadcasts..minutes
SB2008 = mydata$X2008.Share.of.broadcasts...

Question 1: What metadata is available?

The data is from - KU138: Mean Daily Duration of Broadcasting per TV-Broadcaster by Type of Broadcast - a subdivision of broadcasting and culture in the culture dataset.

Question 2: Observed population and reference period

There are 25 observations and 29 variables with data comparison of duration of broadcast and share of broadcast between the year 2008 and 2021

Question 3: What are the data types of the variables?

The datatypes include characters, integers and numbers

Question 4: Are there any outliers?

Graphs plotted below show that there are a few outliers in the duration of broadcast in 2008 as well as share of broadcast in 2008. In 2009 as well, there are two outliers each in both duration of broadcast and share of broadcast.

Question 5: central Tendencies

calculating the mean

mean(Db2008)    #118.96
## [1] 118.96
mean(SB2008)    #13.532
## [1] 13.532

Calculating the median

median(Db2008)  #69
## [1] 69
median(SB2008)  #7.9
## [1] 7.9

calculating the mode

mode = function(x){
  ta = table(x)
  tam = max(ta)
  if(all(ta == tam))
    mod = NA
  else
    if(is.numeric(x))
      mod = as.numeric(names(ta)[ta == tam])
  else
    mod = names(ta)[ta == tam]
  return(mod)
}
mode(Db2008) # 1    3 137
## [1]   1   3 137
mode(SB2008)# 0.1 0.4
## [1] 0.1 0.4

Measuring the variability

calculating the standard Deviation

sd(Db2008) # 189.1057
## [1] 189.1057
sd(SB2008) #21.48485
## [1] 21.48485

calculating IQR

quantile(Db2008) # 1   13 69 135 880
##   0%  25%  50%  75% 100% 
##    1   13   69  135  880
quantile(SB2008)#    0.1 1.5 7.9 15.4 100.0
##    0%   25%   50%   75%  100% 
##   0.1   1.5   7.9  15.4 100.0

3. Provide brief descriptive statistical analysis of your data set (like measures of central tendency and dispersion).

calculating variance where standard deviation measures how much data values are deviated from mean

var(Db2008) #35760.96
## [1] 35760.96
var(SB2008) #461.5989
## [1] 461.5989

4. Include at least one plot into your report. If ggplot2 is too complicated for you now, create a plot with R base functions.

numeric Data Barplot

hist(Db2008)

hist(SB2008)

categorical Data - Barplot

table(Db2008)
## Db2008
##   1   3   4  12  13  20  23  27  35  40  69  71  84  89  95 101 135 137 305 308 
##   2   2   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   1   1 
## 381 880 
##   1   1
table(SB2008)
## SB2008
##  0.1  0.4  0.5  1.4  1.5  2.3  2.6  3.1    4  4.5  7.9  8.1  9.6 10.1 10.8 11.4 
##    2    2    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
## 15.4 15.5 15.6 34.7   35 43.3  100 
##    1    1    1    1    1    1    1
barplot(table(Db2008))

barplot(table(SB2008))

Preparing a dataset- Duration of broadcasts and Share of broadcasts for 2009

Data Summarization

Db2009 = mydata$X2009.Duration.of.broadcasts..minutes
SB2009 = mydata$X2009.Share.of.broadcasts...

Central Tendencies

calculating the mean

mean(Db2009)    #122.92
## [1] 122.92
mean(SB2009)    #13.084
## [1] 13.084

Calculating the median

median(Db2009)  #31
## [1] 31
median(SB2009)  #3.3
## [1] 3.3

calculating the mode

mode = function(x){

  ta = table(x)

  tam = max(ta)

  if(all(ta == tam))

    mod = NA

  else

    if(is.numeric(x))

      mod = as.numeric(names(ta)[ta == tam])

  else

    mod = names(ta)[ta == tam]

  return(mod)

}
mode(Db2009)  # 2 17
## [1]  2 17
mode(SB2009) #0.2 1.8
## [1] 0.2 1.8

Measuring the variability

calculating the standard Deviation

sd(Db2009) #209.7747
## [1] 209.7747
sd(SB2009) #22.3417
## [1] 22.3417

calculating iQR

quantile(Db2009) # 1             13        31        112      939
##   0%  25%  50%  75% 100% 
##    1   13   31  112  939
quantile(SB2009) # 0.1          1.4       3.3       11.9     100.0
##    0%   25%   50%   75%  100% 
##   0.1   1.4   3.3  11.9 100.0

3. Provide brief descriptive statistical analysis of your data set (like measures of central tendency and dispersion).

calculating variance where standard deviation measures how much data values are deviated from mean

var(Db2009)   #44005.41
## [1] 44005.41
var(SB2009)   #499.1514
## [1] 499.1514

4. Include at least one plot into your report. If ggplot2 is too complicated for you now, create a plot with R base functions.

numeric Data Barplot

hist(Db2009)

hist(SB2009)

categorical Data - Barplot

table(Db2009)
## Db2009
##   1   2   4   7  11  13  15  17  23  28  31  34  45  58  63 103 112 186 237 342 
##   1   2   1   1   1   1   1   2   1   1   1   1   1   1   1   1   1   1   1   1 
## 372 411 939 
##   1   1   1
table(SB2009)
## SB2009
##  0.1  0.2  0.4  0.7  1.2  1.4  1.6  1.8  2.4    3  3.3  3.6  4.8  6.2  6.7   11 
##    1    2    1    1    1    1    1    2    1    1    1    1    1    1    1    1 
## 11.9 19.8 25.2 36.4 39.6 43.8  100 
##    1    1    1    1    1    1    1
barplot(table(Db2009))

barplot(table(SB2009))

### Preparing a dataset Duration of broadcasts and Share of broadcasts for 2010

Data Summarization

Db2010 = mydata$X2010.Duration.of.broadcasts..minutes
SB2010 = mydata$X2010.Share.of.broadcasts...

Central Tendencies

calculating the mean

mean(Db2010)    #117.48
## [1] 117.48
mean(SB2010)    #12.756
## [1] 12.756

Calculating the median

median(Db2010)  #24
## [1] 24
median(SB2010)  #2.6
## [1] 2.6

calculating the mode

mode = function(x){

  ta = table(x)

  tam = max(ta)

  if(all(ta == tam))

    mod = NA

  else

    if(is.numeric(x))

      mod = as.numeric(names(ta)[ta == tam])

  else

    mod = names(ta)[ta == tam]

  return(mod)

}

mode(Db2010)  # 2 20  24
## [1]  2 20 24
mode(SB2010) #0.2
## [1] 0.2

Measuring the variability

calculating the standard Deviation

sd(Db2010) #201.6714
## [1] 201.6714
sd(SB2010)#21.89146
## [1] 21.89146

calculating iQR

quantile(Db2009) # 1             13        24        102      921
##   0%  25%  50%  75% 100% 
##    1   13   31  112  939
quantile(SB2009) # 0.2          1.4       2.6       11.1     100.0
##    0%   25%   50%   75%  100% 
##   0.1   1.4   3.3  11.9 100.0

3. Provide brief descriptive statistical analysis of your data set (like measures of central tendency and dispersion).

calculating variance where standard deviation measures how much data values are deviated from mean

var(Db2010)   #40671.34
## [1] 40671.34
var(SB2010)   #479.2359
## [1] 479.2359

4. Include at least one plot into your report. If ggplot2 is too complicated for you now, create a plot with R base functions.

numeric Data Barplot

hist(Db2010)

hist(SB2010)

categorical Data - Barplot

table(Db2010)
## Db2010
##   1   2   4   6  11  13  16  20  21  24  31  56  62  68  92 102 184 235 312 354 
##   1   2   1   1   1   1   1   2   1   2   1   1   1   1   1   1   1   1   1   1 
## 356 921 
##   1   1
table(SB2010)
## SB2010
##  0.2  0.5  0.7  1.1  1.4  1.7  2.2  2.3  2.6  3.4  6.1  6.7  7.3   10 11.1   20 
##    3    1    1    1    1    1    2    1    2    1    1    1    1    1    1    1 
## 25.5 33.9 38.4 38.6  100 
##    1    1    1    1    1
barplot(table(Db2010))

barplot(table(SB2010))