Part 1

Q1) How many data structures does R language have?

Answer:R language have 6 types of Data structures as follows:-

  # Vector
  # List
  # Array
  # Factor
  # Matrix
  # DataFrame

Q2) What is the value of f(5) for the following R code?

b <- 4
f <- function (a)
{
b <- 3
b^3
}

Ans: 27

Q3) Fix the error in the code?

printmessage <- function (a) {
if (is.na (a))
print ("a is a missing value!")
else if (a < 0){
print ("a is less than zero")
}
else{
print ("a is greater than or equal to zero")
}
 }

printmessage (NA)
## [1] "a is a missing value!"

Q4) What is the difference between data frame and a matrix in R?

Answer:# Matrix is Homogeneous, It’s a m*n array with similar data type. EX: A = matrix (c(11, 22, 33, 44, 55, 66),
nrow = 2, ncol = 3) DataFrames are heterogeneous. It can contain multiple data types in multiple columns called fields. Ex: df <- data.frame( col1 = c(1:3, NA), col2 = c(“this”, NA, “is”, “text”), col3 = c(TRUE, FALSE, TRUE, TRUE), col4 = c(2.5, 4.2, 3.2, NA))

Q5) Two vectors X and Y are defined as follows – X <- c(3, 2, 4) and Y <- c(1, 2). What will be output of vector Z that is defined as Z <- X*Y.

X <- c(3, 2, 4)
Y <- c(1, 2)
Z <- X*Y
## Warning in X * Y: longer object length is not a multiple of shorter object
## length
Z
## [1] 3 4 4

Q6) Drop variables v2 & v3 from the below dataframe df<-data.frame(v1=c(1:5),v2=c(2:6),v3=c(3:7),v4=c(4:8))

df<-data.frame(v1=c(1:5),v2=c(2:6),v3=c(3:7),v4=c(4:8)) 
df1 <- df
df1[,c('v2','v3')] <- list(NULL)
df1
##   v1 v4
## 1  1  4
## 2  2  5
## 3  3  6
## 4  4  7
## 5  5  8

Q7) What will be the output of the following R programming code?

x<-5

if(x%%2==0) {

  print("X is an even number")

} else {

  print("X is an odd number")
}  
## [1] "X is an odd number"

Q8) I have a string “”. Which string function can be used to split the string into two different strings “” and “in”?

st <- "contact@boston.in"
strsplit(st,".",fixed = TRUE)
## [[1]]
## [1] "contact@boston" "in"

Q9) Write a R program to find the counts of uniques for the given vector

tt <- c("a", "b", "a", "a", "b", "c", "a1", "a1", "a1")
table(tt)
## tt
##  a a1  b  c 
##  3  3  2  1

Q10) Write a R program to find the cumulative frequency for given vector?

Sales = c(10,2,40,13,34,12,35,67,12,56,14,56,134)
freq <- table(Sales)
cumsum(freq)
##   2  10  12  13  14  34  35  40  56  67 134 
##   1   2   4   5   6   7   8   9  11  12  13

Part 2

For the given dataset carrying out following tasks

Dataset: ## The dataset is given in the link ## 1) Find missing value in the dataset ## 2) Impute missing values in the dataset using missforest package ## 3) Find summary statistics using dplyr package ## 4) What is the avg amount spend by Male and Females? ## 5) Using GGplots library build 5 graphs?

# import the dataset

setwd('E:/Data Science/R-programming/R-Test/Test in R/')
german_cr_data <- read.csv('german_credit_data_risk.csv')

#View(german_cr_data)

summary(german_cr_data) # shows the statistical summary of the dataset fields
##        X              Age            Sex                 Job       
##  Min.   :  0.0   Min.   :19.00   Length:1000        Min.   :0.000  
##  1st Qu.:249.8   1st Qu.:27.00   Class :character   1st Qu.:2.000  
##  Median :499.5   Median :33.00   Mode  :character   Median :2.000  
##  Mean   :499.5   Mean   :35.55                      Mean   :1.904  
##  3rd Qu.:749.2   3rd Qu.:42.00                      3rd Qu.:2.000  
##  Max.   :999.0   Max.   :75.00                      Max.   :3.000  
##    Housing          Saving.accounts    Checking.account   Credit.amount  
##  Length:1000        Length:1000        Length:1000        Min.   :  250  
##  Class :character   Class :character   Class :character   1st Qu.: 1366  
##  Mode  :character   Mode  :character   Mode  :character   Median : 2320  
##                                                           Mean   : 3271  
##                                                           3rd Qu.: 3972  
##                                                           Max.   :18424  
##     Duration      Purpose              Risk          
##  Min.   : 4.0   Length:1000        Length:1000       
##  1st Qu.:12.0   Class :character   Class :character  
##  Median :18.0   Mode  :character   Mode  :character  
##  Mean   :20.9                                        
##  3rd Qu.:24.0                                        
##  Max.   :72.0
str(german_cr_data) ## shows the information about the data structure
## 'data.frame':    1000 obs. of  11 variables:
##  $ X               : int  0 1 2 3 4 5 6 7 8 9 ...
##  $ Age             : int  67 22 49 45 53 35 53 35 61 28 ...
##  $ Sex             : chr  "male" "female" "male" "male" ...
##  $ Job             : int  2 2 1 2 2 1 2 3 1 3 ...
##  $ Housing         : chr  "own" "own" "own" "free" ...
##  $ Saving.accounts : chr  NA "little" "little" "little" ...
##  $ Checking.account: chr  "little" "moderate" NA "little" ...
##  $ Credit.amount   : int  1169 5951 2096 7882 4870 9055 2835 6948 3059 5234 ...
##  $ Duration        : int  6 48 12 42 24 36 24 36 12 30 ...
##  $ Purpose         : chr  "radio/TV" "radio/TV" "education" "furniture/equipment" ...
##  $ Risk            : chr  "good" "bad" "good" "good" ...
head(german_cr_data) ## shows the 1st six records of the dataset
##   X Age    Sex Job Housing Saving.accounts Checking.account Credit.amount
## 1 0  67   male   2     own            <NA>           little          1169
## 2 1  22 female   2     own          little         moderate          5951
## 3 2  49   male   1     own          little             <NA>          2096
## 4 3  45   male   2    free          little           little          7882
## 5 4  53   male   2    free          little           little          4870
## 6 5  35   male   1    free            <NA>             <NA>          9055
##   Duration             Purpose Risk
## 1        6            radio/TV good
## 2       48            radio/TV  bad
## 3       12           education good
## 4       42 furniture/equipment good
## 5       24                 car  bad
## 6       36           education good

1) Find missing value in the dataset

sum(is.na(german_cr_data)) ## shows the total missing values in the dataset
## [1] 577
colSums(is.na(german_cr_data)) ## shows columnwise missing values
##                X              Age              Sex              Job 
##                0                0                0                0 
##          Housing  Saving.accounts Checking.account    Credit.amount 
##                0              183              394                0 
##         Duration          Purpose             Risk 
##                0                0                0

2) Impute missing values in the dataset using missforest package

## replacing each levels of Saving.accounts column with numeric values like replace 'little' wih 1 'moderate' with 2, 'quite rich' with 3 and 'rich' with 4
table(german_cr_data$Saving.accounts)
## 
##     little   moderate quite rich       rich 
##        603        103         63         48
german_cr_data$Saving.accounts[german_cr_data$Saving.accounts=='little'] <- c(1)
german_cr_data$Saving.accounts[german_cr_data$Saving.accounts=='moderate'] <- c(2)
german_cr_data$Saving.accounts[german_cr_data$Saving.accounts=='quite rich'] <- c(3)
german_cr_data$Saving.accounts[german_cr_data$Saving.accounts=='rich'] <- c(4)
class(german_cr_data$Saving.accounts)
## [1] "character"
#convert the datatype of Saving.accounts from character to numetic
german_cr_data$Saving.accounts <- as.numeric(german_cr_data$Saving.accounts)

class(german_cr_data$Saving.accounts)
## [1] "numeric"
## replacing each levels of Checking.account column with numeric
table(german_cr_data$Checking.account)
## 
##   little moderate     rich 
##      274      269       63
german_cr_data$Checking.account[german_cr_data$Checking.account=='little'] <- c(1)
german_cr_data$Checking.account[german_cr_data$Checking.account=='moderate'] <- c(2)
german_cr_data$Checking.account[german_cr_data$Checking.account=='rich'] <- c(4)
class(german_cr_data$Checking.account)
## [1] "character"
#convert the datatype of Checking.account from character to numetic
german_cr_data$Checking.account <- as.numeric(german_cr_data$Checking.account)
class(german_cr_data$Checking.account)
## [1] "numeric"
## selecting only numeric columns from the german_cr_data dataset 
german_cr_data_num <- unlist(lapply(german_cr_data, is.numeric))
## impute missing values using missForest package
library(missForest)
## Warning: package 'missForest' was built under R version 4.0.3
## Loading required package: randomForest
## Warning: package 'randomForest' was built under R version 4.0.3
## randomForest 4.6-14
## Type rfNews() to see new features/changes/bug fixes.
## Loading required package: foreach
## Loading required package: itertools
## Warning: package 'itertools' was built under R version 4.0.3
## Loading required package: iterators
missForest(german_cr_data[,german_cr_data_num])
##   missForest iteration 1 in progress...
## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?
## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?
## done!
##   missForest iteration 2 in progress...
## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?

## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?
## done!
##   missForest iteration 3 in progress...
## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?

## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?
## done!
##   missForest iteration 4 in progress...
## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?

## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?
## done!
##   missForest iteration 5 in progress...
## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?

## Warning in randomForest.default(x = obsX, y = obsY, ntree = ntree, mtry =
## mtry, : The response has five or fewer unique values. Are you sure you want to
## do regression?
## done!
## $ximp
##        X Age Job Saving.accounts Checking.account Credit.amount Duration
## 1      0  67   2        1.838889         1.000000          1169        6
## 2      1  22   2        1.000000         2.000000          5951       48
## 3      2  49   1        1.000000         1.957321          2096       12
## 4      3  45   2        1.000000         1.000000          7882       42
## 5      4  53   2        1.000000         1.000000          4870       24
## 6      5  35   1        1.270000         1.541083          9055       36
## 7      6  53   2        3.000000         1.687000          2835       24
## 8      7  35   3        1.000000         2.000000          6948       36
## 9      8  61   1        4.000000         2.070000          3059       12
## 10     9  28   3        1.000000         2.000000          5234       30
## 11    10  25   2        1.000000         2.000000          1295       12
## 12    11  24   2        1.000000         1.000000          4308       48
## 13    12  22   2        1.000000         2.000000          1567       12
## 14    13  60   1        1.000000         1.000000          1199       24
## 15    14  28   2        1.000000         1.000000          1403       15
## 16    15  32   1        2.000000         1.000000          1282       24
## 17    16  53   2        2.324286         1.810000          2424       24
## 18    17  25   2        1.448333         1.000000          8072       30
## 19    18  44   3        1.000000         2.000000         12579       24
## 20    19  31   2        3.000000         1.562000          3430       24
## 21    20  48   2        1.000000         1.735455          2134        9
## 22    21  44   2        3.000000         1.000000          2647        6
## 23    22  48   1        1.000000         1.000000          2241       10
## 24    23  44   2        2.000000         2.000000          1804       12
## 25    24  26   2        1.530000         1.820000          2069       10
## 26    25  36   1        1.000000         1.000000          1374        6
## 27    26  39   1        1.000000         1.618571           426        6
## 28    27  42   2        4.000000         4.000000           409       12
## 29    28  34   2        1.000000         2.000000          2415        7
## 30    29  63   2        1.000000         1.000000          6836       60
## 31    30  36   2        4.000000         2.000000          1913       18
## 32    31  27   2        1.000000         1.000000          4020       24
## 33    32  30   2        2.000000         2.000000          5866       18
## 34    33  57   1        2.510000         2.547500          1264       12
## 35    34  33   3        1.000000         4.000000          1474       12
## 36    35  25   1        1.000000         2.000000          4746       45
## 37    36  31   2        1.000000         1.599434          6110       48
## 38    37  37   2        1.000000         4.000000          2100       18
## 39    38  37   2        1.000000         4.000000          1225       10
## 40    39  24   2        1.000000         2.000000           458        9
## 41    40  30   3        3.000000         1.575000          2333       30
## 42    41  26   2        3.000000         2.000000          1158       12
## 43    42  44   1        1.000000         2.000000          6204       18
## 44    43  24   2        2.000000         1.000000          6187       30
## 45    44  58   1        1.000000         1.000000          6143       48
## 46    45  35   3        1.000000         2.652020          1393       11
## 47    46  39   2        3.000000         2.057000          2299       36
## 48    47  23   0        3.000000         1.000000          1352        6
## 49    48  39   1        1.000000         2.045655          7228       11
## 50    49  28   2        2.000000         1.830000          2073       12
## 51    50  29   1        1.630000         2.000000          2333       24
## 52    51  30   3        1.000000         2.000000          5965       27
## 53    52  25   2        1.000000         2.033667          1262       12
## 54    53  31   2        1.540000         2.070000          3378       18
## 55    54  57   2        1.000000         2.000000          2225       36
## 56    55  26   1        1.945000         1.942000           783        6
## 57    56  52   3        1.200000         2.000000          6468       12
## 58    57  31   2        1.000000         1.731882          9566       36
## 59    58  23   3        1.000000         4.000000          1961       18
## 60    59  23   1        1.000000         1.000000          6229       36
## 61    60  27   2        1.000000         2.000000          1391        9
## 62    61  50   2        2.482000         2.000000          1537       15
## 63    62  61   3        1.000000         2.000000          1953       36
## 64    63  25   2        1.000000         2.000000         14421       48
## 65    64  26   2        1.000000         1.686685          3181       24
## 66    65  48   2        1.480000         2.003333          5190       27
## 67    66  29   2        1.000000         1.601559          2171       12
## 68    67  22   2        4.000000         2.000000          1007       12
## 69    68  37   2        1.000000         1.792308          1819       36
## 70    69  25   2        1.630000         1.750000          2394       36
## 71    70  30   2        1.000000         1.534549          8133       36
## 72    71  46   1        1.890000         1.656000           730        7
## 73    72  51   3        1.000000         1.000000          1164        8
## 74    73  41   1        1.000000         2.000000          5954       42
## 75    74  40   3        1.160000         1.000000          1977       36
## 76    75  66   3        1.000000         1.000000          1526       12
## 77    76  34   2        1.000000         1.000000          3965       42
## 78    77  51   2        1.000000         2.000000          4771       11
## 79    78  39   1        1.680000         1.950000          9436       54
## 80    79  22   2        1.000000         2.000000          3832       30
## 81    80  44   2        1.135000         1.487727          5943       24
## 82    81  47   2        3.000000         2.177500          1213       15
## 83    82  24   1        2.000000         1.810000          1568       18
## 84    83  58   1        1.000000         1.000000          1755       24
## 85    84  52   1        1.000000         1.000000          2315       10
## 86    85  29   3        1.000000         1.913353          1412       12
## 87    86  27   2        1.000000         2.000000          1295       18
## 88    87  47   2        2.000000         2.000000         12612       36
## 89    88  30   3        2.000000         1.000000          2249       18
## 90    89  28   2        1.000000         1.000000          1108       12
## 91    90  56   2        1.000000         1.756667           618       12
## 92    91  54   2        1.000000         1.000000          1409       12
## 93    92  33   1        1.410000         1.880000           797       12
## 94    93  20   2        1.733750         4.000000          3617       24
## 95    94  54   2        4.000000         2.000000          1318       12
## 96    95  58   2        1.000000         2.000000         15945       54
## 97    96  61   2        2.080000         2.030000          2012       12
## 98    97  34   2        2.000000         2.000000          2622       18
## 99    98  36   2        1.000000         2.000000          2337       36
## 100   99  36   3        1.399143         2.000000          7057       20
## 101  100  41   1        2.000000         2.251000          1469       24
## 102  101  24   2        1.000000         2.000000          2323       36
## 103  102  24   2        1.000000         2.001465           932        6
## 104  103  35   2        1.000000         2.000000          1919        9
## 105  104  26   2        1.570000         1.890000          2445       12
## 106  105  39   3        1.000000         2.000000         11938       24
## 107  106  39   3        1.000000         1.870956          6458       18
## 108  107  32   2        1.000000         2.000000          6078       12
## 109  108  30   2        1.438333         1.000000          7721       24
## 110  109  35   2        3.000000         2.000000          1410       14
## 111  110  31   2        2.000000         2.000000          1449        6
## 112  111  23   2        1.000000         4.000000           392       15
## 113  112  28   1        1.000000         2.000000          6260       18
## 114  113  25   2        1.000000         2.150064          7855       36
## 115  114  35   2        3.000000         1.000000          1680       12
## 116  115  47   2        1.636471         2.050000          3578       48
## 117  116  30   3        1.240000         1.000000          7174       42
## 118  117  27   2        1.382564         1.000000          2132       10
## 119  118  23   2        3.000000         1.000000          4281       33
## 120  119  36   3        3.000000         2.000000          2366       12
## 121  120  25   2        1.000000         1.000000          1835       21
## 122  121  41   3        1.000000         1.973004          3868       24
## 123  122  24   1        1.000000         1.653132          1768       12
## 124  123  63   2        1.000000         4.000000           781       10
## 125  124  27   2        1.362500         2.000000          1924       18
## 126  125  30   2        1.000000         1.000000          2121       12
## 127  126  40   1        1.000000         1.000000           701       12
## 128  127  30   2        1.000000         2.000000           639       12
## 129  128  34   3        1.000000         2.000000          1860       12
## 130  129  29   2        1.000000         1.000000          3499       12
## 131  130  24   2        1.800000         2.000000          8487       48
## 132  131  29   2        1.000000         1.000000          6887       36
## 133  132  27   1        1.000000         1.640750          2708       15
## 134  133  47   2        1.000000         2.151014          1984       18
## 135  134  21   2        2.000000         1.987500         10144       60
## 136  135  38   2        2.130000         2.240833          1240       12
## 137  136  27   2        4.000000         1.850000          8613       27
## 138  137  66   1        3.000000         2.000000           766       12
## 139  138  35   2        2.017500         2.000000          2728       15
## 140  139  44   1        1.000000         4.000000          1881       12
## 141  140  27   0        4.000000         4.000000           709        6
## 142  141  30   3        1.000000         2.000000          4795       36
## 143  142  27   3        1.000000         1.000000          3416       27
## 144  143  22   2        1.000000         1.000000          2462       18
## 145  144  23   2        1.000000         1.574754          2288       21
## 146  145  30   2        2.000000         2.000000          3566       48
## 147  146  39   2        1.000000         1.000000           860        6
## 148  147  51   2        2.000000         1.897500           682       12
## 149  148  28   2        1.000000         1.000000          5371       36
## 150  149  46   2        4.000000         2.093333          1582       18
## 151  150  42   2        2.000000         1.875000          1346        6
## 152  151  38   2        1.000000         2.134457          1924       10
## 153  152  24   2        1.000000         4.000000          5848       36
## 154  153  29   2        4.000000         2.000000          7758       24
## 155  154  36   3        2.000000         2.000000          6967       24
## 156  155  20   2        1.000000         1.000000          1282       12
## 157  156  48   2        2.000000         1.000000          1288        9
## 158  157  45   1        1.000000         1.000000           339       12
## 159  158  38   2        2.000000         2.000000          3512       24
## 160  159  34   1        1.943690         1.886000          1898        6
## 161  160  36   2        2.000000         1.986667          2872       24
## 162  161  30   2        1.000000         1.432305          1055       18
## 163  162  36   2        3.000000         2.457500          1262       15
## 164  163  70   3        1.000000         2.000000          7308       10
## 165  164  36   2        3.000000         2.400000           909       36
## 166  165  32   2        3.000000         1.830000          2978        6
## 167  166  33   2        1.000000         1.000000          1131       18
## 168  167  20   2        4.000000         2.000000          1577       11
## 169  168  25   2        1.000000         2.152283          3972       24
## 170  169  31   2        1.000000         2.000000          1935       24
## 171  170  33   2        1.000000         1.000000           950       15
## 172  171  26   2        1.000000         1.719637           763       12
## 173  172  34   3        1.000000         2.000000          2064       24
## 174  173  33   2        1.000000         2.000000          1414        8
## 175  174  26   2        1.000000         1.000000          3414       21
## 176  175  53   3        1.950000         1.950000          7485       30
## 177  176  42   2        1.000000         1.000000          2577       12
## 178  177  52   2        3.000000         1.000000           338        6
## 179  178  31   3        1.000000         2.009604          1963       12
## 180  179  65   2        1.000000         1.000000           571       21
## 181  180  28   2        1.000000         1.572488          9572       36
## 182  181  30   3        1.000000         2.000000          4455       36
## 183  182  40   1        1.035000         1.000000          1647       21
## 184  183  50   2        4.000000         1.960000          3777       24
## 185  184  36   2        1.000000         2.000000           884       18
## 186  185  31   2        1.000000         1.476029          1360       15
## 187  186  74   3        1.000000         2.000000          5129        9
## 188  187  68   0        1.000000         2.000000          1175       16
## 189  188  20   2        2.000000         1.000000           674       12
## 190  189  33   2        1.000000         2.000000          3244       18
## 191  190  54   3        4.000000         1.800000          4591       24
## 192  191  34   1        2.000000         2.000000          3844       48
## 193  192  36   2        1.000000         2.000000          3915       27
## 194  193  29   2        1.000000         1.622790          2108        6
## 195  194  21   2        2.000000         2.000000          3031       45
## 196  195  34   3        1.000000         2.000000          1501        9
## 197  196  28   2        1.000000         1.659457          1382        6
## 198  197  27   2        2.000000         2.000000           951       12
## 199  198  36   2        1.844167         2.000000          2760       24
## 200  199  40   3        1.000000         2.000000          4297       18
## 201  200  52   2        3.000000         1.850000           936        9
## 202  201  27   1        1.000000         1.000000          1168       12
## 203  202  26   2        1.000000         2.283156          5117       27
## 204  203  21   2        1.000000         1.000000           902       12
## 205  204  38   1        1.000000         1.489712          1495       12
## 206  205  38   3        1.000000         1.000000         10623       30
## 207  206  43   2        1.000000         2.003366          1935       12
## 208  207  26   2        1.000000         2.000000          1424       12
## 209  208  21   1        1.000000         1.000000          6568       24
## 210  209  55   2        4.000000         2.280000          1413       12
## 211  210  33   2        1.905000         1.920000          3074        9
## 212  211  45   1        1.520000         2.160000          3835       36
## 213  212  50   2        1.000000         1.000000          5293       27
## 214  213  66   3        1.000000         4.000000          1908       30
## 215  214  51   2        1.932500         2.130000          3342       36
## 216  215  39   1        1.473333         2.000000           932        6
## 217  216  31   2        1.000000         1.000000          3104       18
## 218  217  23   2        1.000000         4.000000          3913       36
## 219  218  24   1        1.000000         1.000000          3021       24
## 220  219  64   2        1.000000         2.195455          1364       10
## 221  220  26   1        1.000000         2.000000           625       12
## 222  221  23   2        1.030000         1.000000          1200       12
## 223  222  30   2        1.000000         1.708426           707       12
## 224  223  32   2        2.060000         1.923636          2978       24
## 225  224  30   2        1.000000         1.456370          4657       15
## 226  225  27   2        1.000000         1.776712          2613       36
## 227  226  27   2        4.000000         2.000000         10961       48
## 228  227  53   3        1.000000         1.000000          7865       12
## 229  228  22   2        1.000000         1.821230          1478        9
## 230  229  22   2        1.000000         1.000000          3149       24
## 231  230  26   2        1.000000         4.000000          4210       36
## 232  231  51   1        3.000000         2.050000          2507        9
## 233  232  35   2        2.000000         1.860000          2141       12
## 234  233  25   1        1.000000         2.000000           866       18
## 235  234  42   1        1.000000         1.710238          1544        4
## 236  235  30   3        1.000000         1.000000          1823       24
## 237  236  23   0        2.146667         2.000000         14555        6
## 238  237  61   1        2.000000         2.000000          2767       21
## 239  238  35   2        1.000000         1.924842          1291       12
## 240  239  39   2        1.000000         1.000000          2522       30
## 241  240  29   2        1.070000         1.000000           915       24
## 242  241  51   2        1.000000         1.476955          1595        6
## 243  242  24   2        1.000000         1.000000          4605       48
## 244  243  27   2        1.000000         1.526866          1185       12
## 245  244  35   1        3.000000         1.860000          3447       12
## 246  245  25   2        1.000000         2.047917          1258       24
## 247  246  52   2        1.000000         1.643640           717       12
## 248  247  35   2        2.000000         1.783333          1204        6
## 249  248  26   2        1.000000         4.000000          1925       24
## 250  249  22   2        1.000000         2.022952           433       18
## 251  250  39   1        4.000000         1.000000           666        6
## 252  251  46   1        1.000000         4.000000          2251       12
## 253  252  24   2        1.000000         2.000000          2150       30
## 254  253  35   2        2.000000         1.970000          4151       24
## 255  254  24   2        1.167500         2.000000          2030        9
## 256  255  27   1        2.033333         2.000000          7418       60
## 257  256  35   1        1.000000         1.636853          2684       24
## 258  257  29   2        1.000000         1.000000          2149       12
## 259  258  23   2        2.000000         1.970000          3812       15
## 260  259  57   1        2.000000         2.377500          1154       11
## 261  260  27   2        1.000000         1.000000          1657       12
## 262  261  55   2        1.000000         1.000000          1603       24
## 263  262  36   3        1.000000         1.000000          5302       18
## 264  263  57   1        1.000000         1.808571          2748       12
## 265  264  32   1        1.000000         2.034321          1231       10
## 266  265  37   2        1.000000         2.000000           802       15
## 267  266  36   2        1.750000         2.066667          6304       36
## 268  267  38   2        1.000000         1.303441          1533       24
## 269  268  45   3        1.000000         1.000000          8978       14
## 270  269  25   2        1.100000         1.346667           999       24
## 271  270  32   2        2.344000         1.946136          2662       18
## 272  271  37   2        3.000000         2.477500          1402       12
## 273  272  36   3        1.770810         2.000000         12169       48
## 274  273  28   2        1.000000         2.000000          3060       48
## 275  274  34   1        1.000000         1.000000         11998       30
## 276  275  32   2        1.000000         1.608093          2697        9
## 277  276  26   2        1.000000         1.856064          2404       18
## 278  277  49   1        1.070000         1.000000          1262       12
## 279  278  32   2        1.000000         1.560833          4611        6
## 280  279  29   3        2.000000         1.895000          1901       24
## 281  280  23   2        4.000000         1.870000          3368       15
## 282  281  50   2        1.000000         1.533821          1574       12
## 283  282  49   1        2.280000         4.000000          1445       18
## 284  283  63   2        2.900000         2.289500          1520       15
## 285  284  37   2        2.000000         2.000000          3878       24
## 286  285  35   1        1.000000         1.000000         10722       47
## 287  286  26   2        1.000000         1.000000          4788       48
## 288  287  31   3        2.000000         2.000000          7582       48
## 289  288  49   2        1.000000         2.000000          1092       12
## 290  289  48   2        1.000000         1.000000          1024       24
## 291  290  26   2        1.000000         1.975499          1076       12
## 292  291  28   3        1.000000         2.000000          9398       36
## 293  292  44   3        1.000000         1.000000          6419       24
## 294  293  56   2        1.000000         4.000000          4796       42
## 295  294  46   3        1.830000         1.950000          7629       48
## 296  295  26   2        1.000000         2.000000          9960       48
## 297  296  20   2        2.478750         2.085000          4675       12
## 298  297  45   1        2.414000         2.730000          1287       10
## 299  298  43   2        1.000000         1.561139          2515       18
## 300  299  32   2        4.000000         2.000000          2745       21
## 301  300  54   0        1.000000         1.795577           672        6
## 302  301  42   2        1.000000         2.000000          3804       36
## 303  302  37   1        2.375000         4.000000          1344       24
## 304  303  49   2        1.000000         1.000000          1038       10
## 305  304  44   2        3.000000         1.998000         10127       48
## 306  305  33   2        4.000000         2.000000          1543        6
## 307  306  24   1        1.350000         1.960000          4811       30
## 308  307  33   1        2.000000         1.000000           727       12
## 309  308  24   2        1.000000         2.000000          1237        8
## 310  309  22   1        1.000000         2.000000           276        9
## 311  310  40   0        1.590000         2.000000          5381       48
## 312  311  25   2        2.000000         1.948000          5511       24
## 313  312  26   2        1.000000         4.000000          3749       24
## 314  313  25   1        1.000000         2.000000           685       12
## 315  314  29   1        1.665000         4.000000          1494        4
## 316  315  31   2        1.000000         1.000000          2746       36
## 317  316  38   1        1.000000         1.000000           708       12
## 318  317  48   1        1.370000         2.000000          4351       24
## 319  318  32   2        1.000000         1.643919           701       12
## 320  319  27   1        1.000000         1.000000          3643       15
## 321  320  28   3        1.000000         2.000000          4249       30
## 322  321  32   2        1.000000         1.000000          1938       24
## 323  322  34   3        1.000000         1.000000          2910       24
## 324  323  28   2        4.000000         1.000000          2659       18
## 325  324  36   2        1.000000         1.659163          1028       18
## 326  325  39   1        1.000000         1.000000          3398        8
## 327  326  49   2        1.560000         2.380000          5801       12
## 328  327  34   2        4.000000         2.090000          1525       24
## 329  328  31   2        1.000000         4.000000          4473       36
## 330  329  28   2        1.000000         2.000000          1068        6
## 331  330  75   3        1.000000         1.000000          6615       24
## 332  331  30   2        2.000000         1.880000          1864       18
## 333  332  24   3        2.000000         2.000000          7408       60
## 334  333  24   1        2.000000         1.930000         11590       48
## 335  334  23   2        1.000000         1.000000          4110       24
## 336  335  44   3        1.000000         1.000000          3384        6
## 337  336  23   1        1.000000         2.000000          2101       13
## 338  337  24   2        1.060000         1.000000          1275       15
## 339  338  28   2        1.000000         1.000000          4169       24
## 340  339  31   1        1.000000         2.000000          1521       10
## 341  340  24   2        1.000000         2.000000          5743       24
## 342  341  26   1        1.000000         1.000000          3599       21
## 343  342  25   2        3.000000         2.000000          3213       18
## 344  343  33   3        1.000000         2.000000          4439       18
## 345  344  37   1        1.000000         4.000000          3949       10
## 346  345  43   1        1.000000         1.592083          1459       15
## 347  346  23   2        1.000000         2.000000           882       13
## 348  347  23   0        3.000000         2.000000          3758       24
## 349  348  34   1        2.000000         2.026000          1743        6
## 350  349  32   2        4.000000         2.000000          1136        9
## 351  350  23   2        1.000000         2.024286          1236        9
## 352  351  29   2        1.000000         2.000000           959        9
## 353  352  38   3        1.697500         2.210000          3229       18
## 354  353  28   2        1.000000         1.000000          6199       12
## 355  354  46   2        3.000000         2.205000           727       10
## 356  355  23   1        1.000000         2.000000          1246       24
## 357  356  49   2        1.864000         2.410000          2331       12
## 358  357  26   3        1.000000         2.399192          4463       36
## 359  358  28   2        1.000000         1.752378           776       12
## 360  359  23   2        1.000000         1.000000          2406       30
## 361  360  61   2        2.092500         2.000000          1239       18
## 362  361  37   3        1.313667         4.000000          3399       12
## 363  362  36   2        1.000000         4.000000          2247       12
## 364  363  21   2        1.000000         1.515833          1766        6
## 365  364  25   0        1.000000         1.000000          2473       18
## 366  365  36   2        1.000000         2.024842          1542       12
## 367  366  27   2        1.000000         1.599807          3850       18
## 368  367  22   2        1.000000         1.000000          3650       18
## 369  368  42   2        1.000000         1.000000          3446       36
## 370  369  40   2        1.000000         2.000000          3001       18
## 371  370  36   2        1.875500         2.036667          3079       36
## 372  371  33   2        1.000000         1.620182          6070       18
## 373  372  23   2        1.000000         1.991667          2146       10
## 374  373  63   3        1.855667         2.080000         13756       60
## 375  374  60   3        2.000000         2.000000         14782       60
## 376  375  37   2        1.000000         1.000000          7685       48
## 377  376  34   2        1.000000         2.023520          2320       18
## 378  377  36   2        2.042500         2.058333           846        7
## 379  378  57   3        1.000000         2.000000         14318       36
## 380  379  52   1        2.000000         1.796000           362        6
## 381  380  39   2        1.022564         1.000000          2212       20
## 382  381  38   3        1.000000         2.000000         12976       18
## 383  382  25   2        1.110000         1.360000          1283       22
## 384  383  26   2        1.000000         4.000000          1330       12
## 385  384  26   1        2.000000         1.970000          4272       30
## 386  385  25   2        1.000000         1.626905          2238       18
## 387  386  21   2        1.030000         1.295000          1126       18
## 388  387  40   3        1.000000         2.000000          7374       18
## 389  388  27   2        3.000000         2.000000          2326       15
## 390  389  27   2        1.000000         1.724123          1449        9
## 391  390  30   3        1.000000         1.619616          1820       18
## 392  391  19   1        4.000000         2.000000           983       12
## 393  392  39   3        1.000000         1.000000          3249       36
## 394  393  31   2        1.000000         1.000000          1957        6
## 395  394  31   3        1.000000         1.513186          2406        9
## 396  395  32   2        2.000000         2.000000         11760       39
## 397  396  55   3        1.000000         1.000000          2578       12
## 398  397  46   2        1.000000         1.000000          2348       36
## 399  398  46   2        1.000000         2.000000          1223       12
## 400  399  43   1        4.000000         2.498333          1516       24
## 401  400  39   2        1.000000         1.457805          1473       18
## 402  401  28   2        1.600000         2.000000          1887       18
## 403  402  27   2        1.000000         1.598269          8648       24
## 404  403  27   1        1.000000         1.491667           802       14
## 405  404  43   2        1.212500         2.000000          2899       18
## 406  405  22   2        1.000000         2.000000          2039       24
## 407  406  43   2        2.085667         2.040000          2197       24
## 408  407  27   2        1.000000         1.000000          1053       15
## 409  408  26   3        3.000000         2.043000          3235       24
## 410  409  28   2        3.000000         4.000000           939       12
## 411  410  20   2        1.000000         2.000000          1967       24
## 412  411  35   3        1.000000         1.509393          7253       33
## 413  412  42   3        1.000000         1.731520          2292       12
## 414  413  40   1        3.000000         2.420000          1597       10
## 415  414  35   2        1.080000         1.000000          1381       24
## 416  415  35   2        1.000000         1.592000          5842       36
## 417  416  33   1        1.000000         1.000000          2579       12
## 418  417  23   2        1.060000         1.000000          8471       18
## 419  418  31   3        3.000000         1.858000          2782       21
## 420  419  33   2        1.413000         2.000000          1042       18
## 421  420  20   2        4.000000         2.037500          3186       15
## 422  421  30   2        1.400379         2.000000          2028       12
## 423  422  47   1        1.000000         2.000000           958       12
## 424  423  34   3        2.000000         1.945000          1591       21
## 425  424  25   2        1.331500         2.000000          2762       12
## 426  425  21   2        1.000000         2.000000          2779       18
## 427  426  29   2        1.000000         1.463108          2743       28
## 428  427  46   2        4.000000         2.693333          1149       18
## 429  428  20   2        1.000000         1.897262          1313        9
## 430  429  55   0        1.000000         1.000000          1190       18
## 431  430  74   1        1.000000         1.910794          3448        5
## 432  431  29   3        1.000000         2.000000         11328       24
## 433  432  36   3        1.000000         1.000000          1872        6
## 434  433  33   2        1.000000         1.610218          2058       24
## 435  434  25   2        1.000000         1.000000          2136        9
## 436  435  25   2        1.243333         2.000000          1484       12
## 437  436  23   1        3.000000         1.807024           660        6
## 438  437  37   2        4.000000         3.058333          1287       24
## 439  438  65   0        1.000000         1.000000          3394       42
## 440  439  26   0        1.000000         4.000000           609       12
## 441  440  39   3        1.000000         1.863575          1884       12
## 442  441  30   2        1.000000         1.000000          1620       12
## 443  442  29   2        1.000000         2.000000          2629       20
## 444  443  41   1        1.000000         1.307500           719       12
## 445  444  30   3        1.000000         2.000000          5096       48
## 446  445  41   1        2.564000         2.730000          1244        9
## 447  446  34   2        1.000000         1.000000          1842       36
## 448  447  35   2        1.000000         2.000000          2576        7
## 449  448  55   3        1.671667         4.000000          1424       12
## 450  449  61   2        4.000000         2.000000          1512       15
## 451  450  30   3        1.508476         2.210000         11054       36
## 452  451  29   2        1.000000         1.468838           518        6
## 453  452  34   2        1.000000         1.584448          2759       12
## 454  453  35   3        1.000000         1.387838          2670       24
## 455  454  31   2        1.000000         1.000000          4817       24
## 456  455  29   3        1.000000         1.432980          2679       24
## 457  456  36   2        1.000000         1.000000          3905       11
## 458  457  35   2        1.000000         1.000000          3386       12
## 459  458  27   2        1.000000         1.000000           343        6
## 460  459  32   2        1.000000         1.422807          4594       18
## 461  460  37   2        1.000000         1.000000          3620       36
## 462  461  36   2        1.000000         1.000000          1721       15
## 463  462  34   3        1.000000         2.000000          3017       12
## 464  463  38   2        1.445833         2.000000           754       12
## 465  464  34   2        1.000000         1.658210          1950       18
## 466  465  63   2        1.000000         1.000000          2924       24
## 467  466  29   1        1.000000         1.000000          1659       24
## 468  467  32   2        1.863333         1.990000          7238       48
## 469  468  26   2        1.000000         1.852902          2764       33
## 470  469  35   1        1.000000         1.655558          4679       24
## 471  470  22   2        2.000000         2.000000          3092       24
## 472  471  23   2        1.000000         1.000000           448        6
## 473  472  28   1        1.000000         1.000000           654        9
## 474  473  36   3        1.928000         2.275000          1238        6
## 475  474  33   2        1.000000         2.000000          1245       18
## 476  475  26   2        1.000000         1.000000          3114       18
## 477  476  24   2        3.000000         1.742000          2569       39
## 478  477  25   2        1.000000         4.000000          5152       24
## 479  478  39   1        2.000000         2.000000          1037       12
## 480  479  44   2        1.000000         1.000000          1478       15
## 481  480  23   1        1.000000         2.000000          3573       12
## 482  481  26   2        1.000000         2.000000          1201       24
## 483  482  57   2        4.000000         1.000000          3622       30
## 484  483  30   2        4.000000         2.768000           960       15
## 485  484  44   2        3.000000         2.567500          1163       12
## 486  485  47   3        1.000000         2.000000          1209        6
## 487  486  52   2        1.000000         1.666103          3077       12
## 488  487  62   2        1.000000         1.599308          3757       24
## 489  488  35   1        2.000000         2.446000          1418       10
## 490  489  26   2        1.000000         1.538497          3518        6
## 491  490  26   2        1.000000         1.885414          1934       12
## 492  491  42   3        1.000000         2.000000          8318       27
## 493  492  27   2        2.000000         2.816667          1237        6
## 494  493  38   2        1.940000         2.000000           368        6
## 495  494  39   1        1.000000         1.000000          2122       12
## 496  495  20   2        1.431917         1.000000          2996       24
## 497  496  29   3        2.000000         2.000000          9034       36
## 498  497  40   2        1.000000         1.201170          1585       24
## 499  498  32   1        1.000000         2.000000          1301       18
## 500  499  28   2        2.000000         4.000000          1323        6
## 501  500  27   2        1.000000         1.000000          3123       24
## 502  501  42   2        1.000000         1.000000          5493       36
## 503  502  49   2        2.000000         4.000000          1126        9
## 504  503  38   2        2.000000         2.000000          1216       24
## 505  504  24   2        1.000000         1.000000          1207       24
## 506  505  27   1        1.915000         2.837500          1309       10
## 507  506  36   2        3.000000         4.000000          2360       15
## 508  507  34   3        2.000000         2.000000          6850       15
## 509  508  28   2        1.000000         1.322170          1413       24
## 510  509  45   3        2.000000         2.040000          8588       39
## 511  510  26   2        1.000000         1.000000           759       12
## 512  511  32   3        1.000000         1.781838          4686       36
## 513  512  26   2        1.000000         4.000000          2687       15
## 514  513  20   2        1.000000         2.000000           585       12
## 515  514  54   2        2.114000         2.020000          2255       24
## 516  515  37   2        1.000000         1.000000           609        6
## 517  516  40   1        1.000000         1.000000          1361        6
## 518  517  23   2        1.000000         1.639614          7127       36
## 519  518  43   2        2.000000         1.000000          1203        6
## 520  519  36   2        1.530000         1.975000           700        6
## 521  520  44   2        1.000000         1.430974          5507       24
## 522  521  24   2        1.000000         1.000000          3190       18
## 523  522  53   2        1.000000         1.000000          7119       48
## 524  523  23   2        2.000000         1.852500          3488       24
## 525  524  26   1        1.000000         2.000000          1113       18
## 526  525  30   2        1.000000         2.000000          7966       26
## 527  526  31   2        2.000000         2.108636          1532       15
## 528  527  42   1        1.000000         1.643571          1503        4
## 529  528  31   2        1.000000         1.000000          2302       36
## 530  529  41   1        1.000000         1.000000           662        6
## 531  530  32   2        1.000000         2.000000          2273       36
## 532  531  28   2        2.000000         2.000000          2631       15
## 533  532  41   2        1.000000         1.435638          1503       12
## 534  533  26   2        2.000000         2.095000          1311       24
## 535  534  25   2        1.757500         2.022500          3105       24
## 536  535  33   2        1.000000         4.000000          2319       21
## 537  536  75   3        1.157000         1.000000          1374        6
## 538  537  37   2        1.000000         2.000000          3612       18
## 539  538  42   3        1.000000         1.000000          7763       48
## 540  539  45   1        1.000000         4.000000          3049       18
## 541  540  23   2        1.000000         2.000000          1534       12
## 542  541  60   2        1.000000         1.449308          2032       24
## 543  542  31   2        1.069167         1.000000          6350       30
## 544  543  34   1        1.000000         4.000000          2864       18
## 545  544  61   1        1.000000         1.695000          1255       12
## 546  545  43   2        1.000000         1.000000          1333       24
## 547  546  37   2        1.000000         1.743361          2022       24
## 548  547  32   2        1.000000         1.441997          1552       24
## 549  548  24   1        1.000000         1.000000           626       12
## 550  549  35   2        2.080833         1.940000          8858       48
## 551  550  23   2        1.050000         1.152857           996       12
## 552  551  45   1        3.000000         2.090000          1750        6
## 553  552  34   2        1.000000         1.000000          6999       48
## 554  553  27   2        2.000000         2.000000          1995       12
## 555  554  67   3        1.000000         2.000000          1199        9
## 556  555  22   2        1.000000         2.000000          1331       12
## 557  556  28   2        2.000000         2.000000          2278       18
## 558  557  29   2        1.694667         2.005000          5003       21
## 559  558  27   2        1.000000         1.000000          3552       24
## 560  559  31   1        1.000000         2.000000          1928       18
## 561  560  49   2        1.108409         1.000000          2964       24
## 562  561  24   1        1.000000         1.000000          1546       24
## 563  562  29   2        1.000000         4.000000           683        6
## 564  563  37   2        1.714471         2.000000         12389       36
## 565  564  37   3        1.329619         2.000000          4712       24
## 566  565  23   2        2.000000         2.000000          1553       24
## 567  566  36   2        1.000000         1.000000          1372       12
## 568  567  34   2        4.000000         1.862500          2578       24
## 569  568  41   2        1.676471         2.000000          3979       48
## 570  569  31   2        1.000000         1.000000          6758       48
## 571  570  23   1        1.000000         1.000000          3234       24
## 572  571  38   2        1.000000         1.497103          5954       30
## 573  572  26   3        1.400000         1.977667          5433       24
## 574  573  22   1        1.000000         1.000000           806       15
## 575  574  27   1        1.000000         2.000000          1082        9
## 576  575  24   2        1.000000         1.940833          2788       15
## 577  576  27   2        1.000000         2.000000          2930       12
## 578  577  33   2        1.090909         1.537857          1927       24
## 579  578  27   2        1.000000         2.000000          2820       36
## 580  579  27   1        1.000000         1.673808           937       24
## 581  580  30   2        1.000000         2.000000          1056       18
## 582  581  49   1        1.000000         2.000000          3124       12
## 583  582  26   2        1.000000         1.987049          1388        9
## 584  583  33   1        1.000000         2.000000          2384       36
## 585  584  52   3        1.000000         1.517095          2133       12
## 586  585  20   2        1.000000         1.000000          2039       18
## 587  586  36   2        1.000000         1.000000          2799        9
## 588  587  21   1        1.000000         1.000000          1289       12
## 589  588  47   1        1.000000         1.000000          1217       18
## 590  589  60   2        1.000000         1.000000          2246       12
## 591  590  58   1        1.000000         1.000000           385       12
## 592  591  42   2        1.546667         2.000000          1965       24
## 593  592  36   1        4.000000         2.538333          1572       21
## 594  593  20   1        1.000000         2.000000          2718       24
## 595  594  40   3        1.062500         1.000000          1358       24
## 596  595  32   1        2.000000         2.000000           931        6
## 597  596  23   2        1.000000         1.000000          1442       24
## 598  597  36   1        1.000000         2.000000          4241       24
## 599  598  31   2        1.000000         1.753275          2775       18
## 600  599  32   2        1.000000         1.442170          3863       24
## 601  600  45   2        1.000000         2.000000          2329        7
## 602  601  30   2        1.000000         2.000000           918        9
## 603  602  34   1        1.000000         2.000000          1837       24
## 604  603  28   3        1.000000         1.511774          3349       36
## 605  604  23   2        1.000000         4.000000          1275       10
## 606  605  22   2        3.000000         1.000000          2828       24
## 607  606  74   3        1.000000         1.981429          4526       24
## 608  607  50   2        2.000000         2.000000          2671       36
## 609  608  33   2        1.000000         1.950472          2051       18
## 610  609  45   2        2.830000         2.907500          1300       15
## 611  610  22   2        2.000000         1.000000           741       12
## 612  611  48   1        2.000000         4.000000          1240       10
## 613  612  29   2        4.000000         1.000000          3357       21
## 614  613  22   2        1.000000         1.000000          3632       24
## 615  614  22   2        1.000000         1.225476          1808       18
## 616  615  48   3        1.522651         2.000000         12204       48
## 617  616  27   3        1.552976         2.000000          9157       60
## 618  617  37   2        1.000000         1.000000          3676        6
## 619  618  21   2        2.000000         2.000000          3441       30
## 620  619  49   1        1.000000         1.462500           640       12
## 621  620  27   2        1.000000         2.000000          3652       21
## 622  621  32   2        1.000000         1.411195          1530       18
## 623  622  38   2        1.896471         1.985000          3914       48
## 624  623  22   2        1.000000         1.000000          1858       12
## 625  624  65   2        1.000000         1.000000          2600       18
## 626  625  35   2        1.756000         2.130000          1979       15
## 627  626  41   2        1.000000         4.000000          2116        6
## 628  627  29   2        2.000000         2.000000          1437        9
## 629  628  36   2        3.000000         2.031667          4042       42
## 630  629  64   1        1.870000         2.390000          3832        9
## 631  630  28   2        1.000000         1.000000          3660       24
## 632  631  44   2        1.000000         1.000000          1553       18
## 633  632  23   2        1.430000         2.000000          1444       15
## 634  633  19   2        1.000000         1.768810          1980        9
## 635  634  25   1        1.000000         2.000000          1355       24
## 636  635  47   2        1.000000         1.626809          1393       12
## 637  636  28   2        3.000000         2.536667          1376       24
## 638  637  21   2        1.000000         1.571126         15653       60
## 639  638  34   2        1.000000         1.668592          1493       12
## 640  639  26   2        1.000000         1.000000          4370       42
## 641  640  27   0        1.000000         1.000000           750       18
## 642  641  38   1        1.000000         2.000000          1308       15
## 643  642  40   3        2.000000         2.140000          4623       15
## 644  643  33   2        1.000000         1.689504          1851       24
## 645  644  32   3        1.000000         1.000000          1880       18
## 646  645  27   2        1.900000         1.950000          7980       36
## 647  646  32   2        1.000000         1.000000          4583       30
## 648  647  26   2        3.000000         2.167500          1386       12
## 649  648  38   2        1.000000         4.000000           947       24
## 650  649  40   1        1.000000         1.000000           684       12
## 651  650  50   3        1.000000         1.000000          7476       48
## 652  651  37   1        1.000000         2.000000          1922       12
## 653  652  45   2        1.000000         1.000000          2303       24
## 654  653  42   3        2.000000         2.000000          8086       36
## 655  654  35   2        1.000000         1.903965          2346       24
## 656  655  22   2        1.000000         1.000000          3973       14
## 657  656  41   1        1.000000         2.000000           888       12
## 658  657  37   2        1.989804         1.940000         10222       48
## 659  658  28   2        1.000000         2.000000          4221       30
## 660  659  41   2        1.000000         2.000000          6361       18
## 661  660  23   2        1.000000         4.000000          1297       12
## 662  661  23   2        1.096333         1.000000           900       12
## 663  662  50   2        1.000000         1.910269          2241       21
## 664  663  35   3        1.000000         2.000000          1050        6
## 665  664  50   1        1.000000         4.000000          1047        6
## 666  665  27   3        1.000000         1.833488          6314       24
## 667  666  34   2        4.000000         2.000000          3496       30
## 668  667  27   2        1.000000         1.472063          3609       48
## 669  668  43   2        1.000000         1.000000          4843       12
## 670  669  47   2        1.000000         4.000000          3017       30
## 671  670  27   1        2.000000         1.960000          4139       24
## 672  671  31   2        2.000000         2.030000          5742       36
## 673  672  42   3        1.000000         1.577988         10366       60
## 674  673  24   2        3.000000         1.883333          2080        6
## 675  674  41   1        3.000000         2.215000          2580       21
## 676  675  26   3        1.000000         1.915655          4530       30
## 677  676  33   2        1.000000         1.958103          5150       24
## 678  677  24   2        2.000000         2.000000          5595       72
## 679  678  64   1        1.000000         1.000000          2384       24
## 680  679  26   2        1.000000         1.575957          1453       18
## 681  680  56   2        1.000000         2.283048          1538        6
## 682  681  37   2        2.001000         2.580000          2279       12
## 683  682  33   2        1.000000         1.829476          1478       15
## 684  683  47   2        1.000000         1.926103          5103       24
## 685  684  31   1        2.000000         2.000000          9857       36
## 686  685  34   2        1.815000         1.930000          6527       60
## 687  686  27   2        1.356667         4.000000          1347       10
## 688  687  30   2        2.000000         2.000000          2862       36
## 689  688  35   2        2.000000         1.920000          2753        9
## 690  689  31   2        4.000000         1.000000          3651       12
## 691  690  25   2        1.000000         1.000000           975       15
## 692  691  25   1        2.000000         2.000000          2631       15
## 693  692  29   2        2.000000         2.000000          2896       24
## 694  693  44   1        1.282556         1.000000          4716        6
## 695  694  28   2        1.000000         1.700196          2284       24
## 696  695  50   2        3.000000         2.360000          1236        6
## 697  696  29   2        1.000000         2.000000          1103       12
## 698  697  38   0        1.000000         2.198107           926       12
## 699  698  24   2        1.000000         1.495000          1800       18
## 700  699  40   3        1.000000         4.000000          1905       15
## 701  700  29   1        3.000000         2.530000          1123       12
## 702  701  46   2        1.000000         1.000000          6331       48
## 703  702  47   2        2.000000         4.000000          1377       24
## 704  703  41   2        2.000000         2.000000          2503       30
## 705  704  32   2        1.000000         2.000000          2528       27
## 706  705  35   2        3.000000         1.922000          5324       15
## 707  706  24   2        2.000000         2.000000          6560       48
## 708  707  25   2        1.000000         2.000000          2969       12
## 709  708  25   2        1.000000         2.000000          1206        9
## 710  709  37   1        1.000000         2.000000          2118        9
## 711  710  32   3        3.000000         2.028000           629       18
## 712  711  35   2        1.000000         1.000000          1198        6
## 713  712  46   3        1.960000         2.340000          2476       21
## 714  713  25   1        1.000000         1.000000          1138        9
## 715  714  27   3        1.000000         2.000000         14027       60
## 716  715  63   2        1.753333         2.200000          7596       30
## 717  716  40   2        2.225000         2.340000          3077       30
## 718  717  32   3        1.000000         1.598560          1505       18
## 719  718  31   2        1.511667         4.000000          3148       24
## 720  719  31   2        2.000000         2.000000          6148       20
## 721  720  34   3        1.000000         4.000000          1337        9
## 722  721  24   2        4.000000         2.000000           433        6
## 723  722  24   1        1.000000         1.000000          1228       12
## 724  723  66   1        3.000000         2.000000           790        9
## 725  724  21   2        1.000000         1.426529          2570       27
## 726  725  41   1        4.000000         1.850000           250        6
## 727  726  47   1        3.000000         3.315357          1316       15
## 728  727  25   2        1.000000         1.000000          1882       18
## 729  728  59   2        1.000000         2.000000          6416       48
## 730  729  36   2        4.000000         4.000000          1275       24
## 731  730  33   2        1.000000         2.000000          6403       24
## 732  731  21   1        1.000000         1.000000          1987       24
## 733  732  44   1        1.000000         2.000000           760        8
## 734  733  28   2        4.000000         1.557500          2603       24
## 735  734  37   2        1.000000         1.677143          3380        4
## 736  735  29   0        1.807500         2.000000          3990       36
## 737  736  23   3        1.000000         2.000000         11560       24
## 738  737  35   1        2.000000         1.000000          4380       18
## 739  738  45   3        1.000000         1.629643          6761        6
## 740  739  26   1        2.000000         2.000000          4280       30
## 741  740  32   2        2.000000         1.000000          2325       24
## 742  741  23   1        1.000000         2.000000          1048       10
## 743  742  41   2        2.270000         2.035000          3160       21
## 744  743  22   2        3.000000         1.000000          2483       24
## 745  744  30   3        1.080000         1.000000         14179       39
## 746  745  28   1        1.000000         1.000000          1797       13
## 747  746  23   2        1.000000         1.000000          2511       15
## 748  747  37   1        1.000000         1.000000          1274       12
## 749  748  26   2        1.520000         2.030000          5248       21
## 750  749  33   2        1.000000         1.886964          3029       15
## 751  750  49   2        1.000000         1.000000           428        6
## 752  751  23   1        1.000000         1.000000           976       18
## 753  752  23   1        2.000000         2.000000           841       12
## 754  753  25   2        1.000000         1.804714          5771       30
## 755  754  55   2        4.000000         2.290000          1555       12
## 756  755  32   2        1.318333         1.000000          1285       24
## 757  756  74   0        1.000000         4.000000          1299        6
## 758  757  39   2        2.001667         4.000000          1271       15
## 759  758  31   2        1.000000         1.409363          1393       24
## 760  759  35   2        1.000000         1.000000           691       12
## 761  760  59   2        1.780000         2.300000          5045       15
## 762  761  24   2        1.000000         1.000000          2124       18
## 763  762  24   1        1.000000         1.000000          2214       12
## 764  763  30   3        1.420667         1.902857         12680       21
## 765  764  27   2        2.000000         1.522500          2463       24
## 766  765  40   1        1.000000         2.000000          1155       12
## 767  766  31   1        1.000000         1.000000          3108       30
## 768  767  31   2        1.574048         2.110000          2901       10
## 769  768  28   2        1.000000         2.000000          3617       12
## 770  769  63   1        1.000000         1.723750          1655       12
## 771  770  26   2        1.693833         1.000000          2812       24
## 772  771  25   3        1.000000         1.000000          8065       36
## 773  772  36   3        1.000000         1.704036          3275       21
## 774  773  52   2        2.000000         2.240000          2223       24
## 775  774  66   0        3.000000         4.000000          1480       12
## 776  775  25   2        1.289167         1.000000          1371       24
## 777  776  37   2        1.000000         1.369968          3535       36
## 778  777  25   2        1.000000         1.000000          3509       18
## 779  778  38   3        4.000000         2.070000          5711       36
## 780  779  67   2        1.000000         2.000000          3872       18
## 781  780  25   2        1.000000         2.000000          4933       39
## 782  781  60   2        4.000000         2.155000          1940       24
## 783  782  31   1        1.000000         2.000000          1410       12
## 784  783  23   1        2.000000         2.000000           836       12
## 785  784  60   3        1.416429         2.000000          6468       20
## 786  785  35   1        4.000000         2.000000          1941       18
## 787  786  40   2        3.000000         2.167000          2675       22
## 788  787  38   2        2.321429         2.240000          2751       48
## 789  788  50   2        1.000000         2.000000          6224       48
## 790  789  27   2        1.000000         1.000000          5998       40
## 791  790  39   2        1.000000         2.000000          1188       21
## 792  791  41   3        1.710000         2.030000          6313       24
## 793  792  27   2        1.930000         2.485000          1221        6
## 794  793  51   2        1.000000         4.000000          2892       24
## 795  794  32   2        3.000000         1.673500          3062       24
## 796  795  22   2        2.000000         1.873333          2301        9
## 797  796  51   2        1.070000         1.000000          7511       18
## 798  797  22   1        1.000000         1.530736          1258       12
## 799  798  54   2        2.720000         2.460000           717       24
## 800  799  35   0        1.640000         2.000000          1549        9
## 801  800  54   2        1.000000         1.697857          1597       24
## 802  801  48   1        1.000000         2.000000          1795       18
## 803  802  24   2        1.000000         1.000000          4272       20
## 804  803  35   2        2.545000         2.438000           976       12
## 805  804  24   0        1.490833         2.000000          7472       12
## 806  805  24   2        1.000000         1.000000          9271       36
## 807  806  26   1        1.000000         2.000000           590        6
## 808  807  65   2        2.536667         2.670000           930       12
## 809  808  55   3        1.000000         2.000000          9283       42
## 810  809  26   0        1.000000         2.000000          1778       15
## 811  810  26   2        1.000000         2.000000           907        8
## 812  811  28   1        1.000000         2.000000           484        6
## 813  812  24   2        1.000000         1.000000          9629       36
## 814  813  54   2        1.000000         1.000000          3051       48
## 815  814  46   2        1.000000         1.000000          3931       48
## 816  815  54   2        1.000000         2.000000          7432       36
## 817  816  62   2        3.000000         2.432500          1338        6
## 818  817  24   2        1.000000         2.108333          1554        6
## 819  818  43   3        1.000000         1.000000         15857       36
## 820  819  26   2        1.000000         1.000000          1345       18
## 821  820  27   2        1.000000         1.617333          1101       12
## 822  821  24   2        1.000000         4.000000          3016       12
## 823  822  41   2        1.000000         1.000000          2712       36
## 824  823  47   1        1.000000         1.000000           731        8
## 825  824  35   3        1.000000         1.219762          3780       18
## 826  825  30   2        1.000000         1.000000          1602       21
## 827  826  33   2        1.000000         1.000000          3966       18
## 828  827  36   2        1.000000         1.228500          4165       18
## 829  828  47   2        1.020000         1.000000          8335       36
## 830  829  38   2        1.676471         2.000000          6681       48
## 831  830  44   2        3.000000         2.057000          2375       24
## 832  831  23   2        1.000000         1.000000          1216       18
## 833  832  29   2        1.000000         1.000000         11816       45
## 834  833  42   2        1.430000         2.000000          5084       24
## 835  834  25   1        1.000000         4.000000          2327       15
## 836  835  48   2        1.000000         1.000000          1082       12
## 837  836  21   2        1.073333         1.200000           886       12
## 838  837  23   1        1.000000         2.336648           601        4
## 839  838  63   2        1.000000         1.000000          2957       24
## 840  839  46   2        1.000000         1.261307          2611       24
## 841  840  29   2        1.000000         1.000000          5179       36
## 842  841  28   1        1.000000         1.390714          2993       21
## 843  842  23   2        1.000000         1.155714          1943       18
## 844  843  50   2        1.000000         1.426307          1559       24
## 845  844  47   2        1.000000         1.375278          3422       18
## 846  845  35   2        2.077333         2.000000          3976       21
## 847  846  68   2        1.564000         2.200000          6761       18
## 848  847  28   2        1.000000         1.227500          1249       24
## 849  848  59   2        1.000000         1.000000          1364        9
## 850  849  57   1        1.000000         1.000000           709       12
## 851  850  33   2        1.000000         1.000000          2235       20
## 852  851  43   2        1.727500         1.950000          4042       24
## 853  852  35   2        1.000000         1.210000          1471       15
## 854  853  32   1        1.000000         1.000000          1442       18
## 855  854  45   2        1.000000         1.360778         10875       36
## 856  855  33   2        2.000000         1.617500          1474       24
## 857  856  40   2        2.340000         2.333333           894       10
## 858  857  28   2        1.000000         1.163214          3343       15
## 859  858  29   2        1.000000         1.000000          3959       15
## 860  859  26   2        2.000000         1.953333          3577        9
## 861  860  27   2        4.000000         1.802500          5804       24
## 862  861  28   2        1.000000         1.083214          2169       18
## 863  862  35   2        1.000000         1.000000          2439       24
## 864  863  32   1        4.000000         1.799333          4526       27
## 865  864  25   1        1.000000         1.891667          2210       10
## 866  865  20   2        3.000000         1.830000          2221       15
## 867  866  27   2        1.000000         1.000000          2389       18
## 868  867  42   2        1.000000         1.256944          3331       12
## 869  868  37   2        2.193333         2.000000          7409       36
## 870  869  24   2        1.000000         1.000000           652       12
## 871  870  40   2        3.000000         2.028000          7678       36
## 872  871  46   2        1.000000         4.000000          1343        6
## 873  872  26   2        2.000000         1.000000          1382       24
## 874  873  24   2        1.870000         1.807500           874       15
## 875  874  29   1        1.000000         1.000000          3590       12
## 876  875  40   2        4.000000         2.000000          1322       11
## 877  876  36   3        1.000000         1.000000          1940       18
## 878  877  28   2        1.000000         1.175159          3595       36
## 879  878  27   3        1.000000         1.000000          1422        9
## 880  879  36   2        1.995000         1.950000          6742       30
## 881  880  38   3        1.000000         1.331429          7814       24
## 882  881  48   2        1.460000         2.150000          9277       24
## 883  882  36   2        2.171667         2.000000          2181       30
## 884  883  65   0        1.000000         1.641667          1098       18
## 885  884  43   2        1.000000         2.000000          4057       24
## 886  885  53   2        1.000000         1.000000           795       12
## 887  886  34   2        2.192167         2.000000          2825       24
## 888  887  23   2        1.000000         2.000000         15672       48
## 889  888  34   3        1.000000         1.425873          6614       36
## 890  889  40   2        2.226667         1.980000          7824       28
## 891  890  43   3        1.000000         1.000000          2442       27
## 892  891  46   2        1.000000         1.289444          1829       15
## 893  892  38   1        1.000000         1.000000          2171       12
## 894  893  34   2        1.000000         2.000000          5800       36
## 895  894  29   2        1.020000         1.160000          1169       18
## 896  895  31   3        1.790476         2.003333          8947       36
## 897  896  28   3        1.000000         1.000000          2606       21
## 898  897  35   2        4.000000         1.730000          1592       12
## 899  898  33   1        1.702500         1.847857          2186       15
## 900  899  42   2        1.000000         1.000000          4153       18
## 901  900  43   2        1.000000         1.000000          2625       16
## 902  901  44   2        1.854000         2.035000          3485       20
## 903  902  42   2        1.940000         2.040000         10477       36
## 904  903  40   2        2.700000         2.410000          1386       15
## 905  904  36   3        1.000000         1.320000          1278       24
## 906  905  20   3        1.000000         1.000000          1107       12
## 907  906  24   1        1.172000         1.000000          3763       21
## 908  907  27   2        1.711000         2.000000          3711       36
## 909  908  46   1        1.000000         1.349524          3594       15
## 910  909  33   1        1.482500         2.000000          3195        9
## 911  910  34   2        1.000000         1.591444          4454       36
## 912  911  25   1        1.000000         2.000000          4736       24
## 913  912  25   2        1.640500         2.000000          2991       30
## 914  913  28   2        4.000000         1.810000          2142       11
## 915  914  31   2        1.000000         1.000000          3161       24
## 916  915  32   3        1.000000         2.000000         18424       48
## 917  916  32   2        2.000000         1.930000          2848       10
## 918  917  68   3        1.000000         1.000000         14896        6
## 919  918  33   2        2.000000         1.000000          2359       24
## 920  919  39   3        1.000000         1.000000          3345       24
## 921  920  28   2        1.000000         1.132500          1817       18
## 922  921  37   3        3.000000         2.028000         12749       48
## 923  922  22   2        1.000000         1.000000          1366        9
## 924  923  30   2        1.000000         2.000000          2002       12
## 925  924  55   2        1.000000         1.000000          6872       24
## 926  925  46   2        1.000000         1.000000           697       12
## 927  926  21   2        1.000000         1.000000          1049       18
## 928  927  39   2        1.000000         1.000000         10297       48
## 929  928  58   2        1.887500         2.170000          1867       30
## 930  929  43   1        1.000000         1.000000          1344       12
## 931  930  24   1        1.000000         1.000000          1747       24
## 932  931  22   2        1.000000         2.000000          1670        9
## 933  932  30   2        1.000000         2.083333          1224        9
## 934  933  42   2        3.000000         2.338000           522       12
## 935  934  23   2        1.000000         1.000000          1498       12
## 936  935  30   3        2.000000         2.000000          1919       30
## 937  936  28   1        1.000000         4.000000           745        9
## 938  937  30   3        1.000000         2.000000          2063        6
## 939  938  42   2        1.000000         2.000000          6288       60
## 940  939  46   3        1.030000         1.170000          6842       24
## 941  940  45   3        1.497500         2.390000          3527       12
## 942  941  31   1        1.000000         2.055476          1546       10
## 943  942  31   2        2.082500         2.041333           929       24
## 944  943  42   1        1.000000         2.242262          1455        4
## 945  944  46   2        1.000000         1.000000          1845       15
## 946  945  30   2        3.000000         2.000000          8358       48
## 947  946  30   2        3.000000         1.000000          3349       24
## 948  947  38   3        1.720000         2.180000          2859       12
## 949  948  43   1        1.000000         1.245476          1533       18
## 950  949  31   2        2.000000         1.758333          3621       24
## 951  950  40   0        1.000000         2.000000          3590       18
## 952  951  24   2        1.000000         1.000000          2145       36
## 953  952  28   2        3.000000         2.000000          4113       24
## 954  953  26   3        1.000000         1.283206         10974       36
## 955  954  29   2        1.000000         1.000000          1893       12
## 956  955  57   3        4.000000         1.000000          1231       24
## 957  956  49   1        1.440000         4.000000          3656       30
## 958  957  37   1        1.000000         2.000000          1154        9
## 959  958  45   1        1.000000         1.000000          4006       28
## 960  959  30   2        2.000000         2.000000          3069       24
## 961  960  30   2        1.000000         1.913214          1740        6
## 962  961  47   2        1.000000         2.000000          2353       21
## 963  962  29   2        1.880000         2.010000          3556       15
## 964  963  35   2        3.000000         1.862000          2397       24
## 965  964  22   1        1.000000         2.000000           454        6
## 966  965  26   2        1.809167         2.000000          1715       30
## 967  966  23   1        3.000000         2.000000          2520       27
## 968  967  54   3        1.000000         1.468095          3568       15
## 969  968  29   2        2.100000         2.065000          7166       42
## 970  969  40   1        1.000000         1.000000          3939       11
## 971  970  22   2        2.000000         2.000000          1514       15
## 972  971  43   1        1.000000         1.420000          7393       24
## 973  972  29   0        1.000000         1.000000          1193       24
## 974  973  36   2        1.000000         1.000000          7297       60
## 975  974  33   2        1.000000         1.421429          2831       30
## 976  975  57   1        3.000000         4.000000          1258       24
## 977  976  64   2        1.000000         2.000000           753        6
## 978  977  42   2        1.561500         2.000000          2427       18
## 979  978  47   1        1.000000         1.650000          2538       24
## 980  979  25   2        2.000000         2.000000          1264       15
## 981  980  49   2        1.000000         2.000000          8386       30
## 982  981  33   3        1.000000         1.948095          4844       48
## 983  982  28   3        2.000000         4.000000          2923       21
## 984  983  26   2        1.000000         1.000000          8229       36
## 985  984  30   1        1.000000         1.500000          2028       24
## 986  985  25   2        1.000000         1.000000          1433       15
## 987  986  33   2        1.000000         4.000000          6289       42
## 988  987  64   2        2.000000         2.663333          1409       13
## 989  988  29   3        1.000000         1.000000          6579       24
## 990  989  48   1        1.000000         2.000000          1743       24
## 991  990  37   1        1.888333         2.560000          3565       12
## 992  991  34   1        2.000000         2.450000          1569       15
## 993  992  23   1        1.020000         1.000000          1936       18
## 994  993  30   3        1.000000         1.000000          3959       36
## 995  994  50   2        2.000000         2.630000          2390       12
## 996  995  31   1        1.000000         1.592143          1736       12
## 997  996  40   3        1.000000         1.000000          3857       30
## 998  997  38   2        1.000000         1.472500           804       12
## 999  998  23   2        1.000000         1.000000          1845       45
## 1000 999  27   2        2.000000         2.000000          4576       45
## 
## $OOBerror
##        NRMSE 
## 0.0002888457 
## 
## attr(,"class")
## [1] "missForest"

3) Find summary statistics using dplyr package

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:randomForest':
## 
##     combine
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
german_cr_data %>% group_by(Sex) %>%
  summarise(Mean_age=mean(Age),StndDev=sd(Age),Max_age=max(Age),Min_age = min(Age),Quartile_1=quantile(Age,prob=c(0.25)),Median=quantile(Age,prob=c(0.50)),Quartile_3=quantile(Age,prob=c(0.75)))
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 2 x 8
##   Sex    Mean_age StndDev Max_age Min_age Quartile_1 Median Quartile_3
##   <chr>     <dbl>   <dbl>   <int>   <int>      <dbl>  <dbl>      <dbl>
## 1 female     32.8    11.8      75      19         24     29         37
## 2 male       36.8    11.0      75      20         28     35         43

The above table shows the statistical information of the Age column.

german_cr_data %>% group_by(Sex) %>%
  summarise(Mean_age=mean(Credit.amount),StndDev=sd(Credit.amount),Max_credit=max(Credit.amount),Min_credit = min(Credit.amount),Quartile_1=quantile(Credit.amount,prob=c(0.25)),Median=quantile(Credit.amount,prob=c(0.50)),Quartile_3=quantile(Credit.amount,prob=c(0.75)))
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 2 x 8
##   Sex    Mean_age StndDev Max_credit Min_credit Quartile_1 Median Quartile_3
##   <chr>     <dbl>   <dbl>      <int>      <int>      <dbl>  <dbl>      <dbl>
## 1 female    2878.   2603.      18424        250      1248.  1959       3606.
## 2 male      3448.   2900.      15945        276      1442.  2444.      4266.

The above table the statistical information of the Credit.amount column

4) What is the avg amount spend by Male and Females?

german_cr_data %>% group_by(Sex) %>%
  summarise(Max_cr_amt=max(Credit.amount),Min_cr_amt=min(Credit.amount),Avg_cr_amt=mean(Credit.amount))
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 2 x 4
##   Sex    Max_cr_amt Min_cr_amt Avg_cr_amt
##   <chr>       <int>      <int>      <dbl>
## 1 female      18424        250      2878.
## 2 male        15945        276      3448.
library(ggplot2)
## 
## Attaching package: 'ggplot2'
## The following object is masked from 'package:randomForest':
## 
##     margin
ggplot(german_cr_data, aes(Sex, mean(Credit.amount)))+geom_bar(stat = "identity") + ggtitle("Average credit amount of Male and Female customers") + scale_y_continuous("Average credit", breaks = seq(0,4000,by = 500)) + theme_bw()

Insight : From the above bar chart it is clear that the average credit is more by Male customers than by Female.

5) Using GGplots library build 5 graphs?

library(ggplot2)
ggplot(german_cr_data, aes(Age,Sex,fill=Sex)) +geom_boxplot(outlier.colour="red") +ggtitle("Box Plot showing statistical Age data of Male and Female") + theme(axis.text.x = element_text(angle = 70, vjust = 0.5, colour = "red")) + xlab("Age") + ylab("Sex") + stat_summary(fun.y=mean, geom="point")+ coord_flip()
## Warning: `fun.y` is deprecated. Use `fun` instead.

Insight: The above box plot indicates that the 50% female customers age lie between 24 to 37 and male customers 28 to 43. Average age of female customer is around 32 and male customer is 36. Age of female customers after 55 can be consider as outliers and for male customers age after 65 are outliers.

ggplot(german_cr_data, aes(x = factor(1), fill = factor(Sex))) + geom_bar(width = 1) + coord_polar(theta = "y")

a <- table(german_cr_data$Sex)
pct = round(a / sum(a) * 100)
lbs = paste(c("Female", "Male"), " ", pct, "%", sep = " ")
library(plotrix)
## Warning: package 'plotrix' was built under R version 4.0.3
pie3D(a, labels = lbs,
      main = "Pie Chart Showing Ratio of Female and Male")

Insight: Percentage of male customers data available in the dataset are more than the female.

ggplot(german_cr_data, aes(Sex, fill = Risk)) + geom_bar()+
  labs(title = "Risk Count for male and female category", x = "Sex", y = "Count of Risk")

Insight:The above stacked bar chart indicates that the good risk is higher than the bad risk for both female and male customers. Also, risk from female customer is around 30% which is less than the male customers which is around 70% ()[calculation done as follows:-]

contable1<-table(german_cr_data$Sex,german_cr_data$Risk)
contable1
##         
##          bad good
##   female 109  201
##   male   191  499
prop.table(contable1)
##         
##            bad  good
##   female 0.109 0.201
##   male   0.191 0.499
ggplot(german_cr_data, aes(Duration, Credit.amount)) + geom_point(aes(color = Purpose)) + 
  scale_x_continuous("Duration", breaks = seq(0,80,10))+
  scale_y_continuous("Credit.amount", breaks = seq(200,20000,by = 1000))+
  theme_bw() + labs(title="Scatter Plot for Duration and Purpose of Credit")

Insight: This scatter plot shows the co-relationship between the credit and duration of the data for different purposes.

ggplot(german_cr_data, aes(x = Risk, y=Credit.amount))+ ggtitle("Bar Plot showing Credit Risk for different Purposes")+
  geom_bar(
    aes(fill = Purpose), stat = "identity", color = "white",
    position = position_dodge(0.9)
    )+
  facet_wrap(~Sex) 

Insight:The above bar chart shows the good and bad risk of different purposes and their corresponding credit amount.

ggplot(german_cr_data, aes(Housing, Risk))+
  geom_raster(aes(fill = Credit.amount))+
  labs(title ="Heat Map showing Risk based on Housing", x = "Housing", y = "Risk")+
  scale_fill_continuous(name = "Credit.amount") 

Insight: The above heat map shows how risk factor depend on the living/housing status of the customers.It also shows the credit feature as per their living. In case of good risk the credit amount decreases from free Housing to own housing to rent housing. In case of bad risk, the credit amount increases from free housing to rent housing to own housing.