Business Intelligence Project

Student Details

Student ID Number 136804
Student Name Joy Mutai
BBIT 4.2 Group C
BI Project Group Name/ID (if applicable) …

#1.Descriptive Statistics and Inferential Statistics

######Issue 1. Descriptive Statistics ----
###Download sample datasets ----
require("readr")
## Loading required package: readr
library(readr)

###Load the Dataset
library(readr)
housing <- read_csv("data/housing.csv")   
## Rows: 20640 Columns: 10

## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ocean_proximity
## dbl (9): longitude, latitude, housing_median_age, total_rooms, total_bedroom...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
dim(housing)
## [1] 20640    10
dim(housing)
## [1] 20640    10
##Step 1: Measure of Frequency---
housing_freq <- housing$households
cbind(frequency = table(housing_freq),
      percentage = prop.table(table(housing_freq)) * 100)
##      frequency  percentage
## 1            1 0.004844961
## 2            3 0.014534884
## 3            4 0.019379845
## 4            4 0.019379845
## 5            7 0.033914729
## 6            5 0.024224806
## 7           10 0.048449612
## 8            8 0.038759690
## 9            9 0.043604651
## 10           7 0.033914729
## 11           4 0.019379845
## 12           2 0.009689922
## 13          10 0.048449612
## 14          12 0.058139535
## 15           7 0.033914729
## 16          10 0.048449612
## 17           6 0.029069767
## 18           4 0.019379845
## 19           6 0.029069767
## 20           8 0.038759690
## 21          12 0.058139535
## 22           9 0.043604651
## 23           7 0.033914729
## 24           5 0.024224806
## 25           8 0.038759690
## 26           6 0.029069767
## 27          11 0.053294574
## 28           3 0.014534884
## 29           9 0.043604651
## 30           5 0.024224806
## 31           6 0.029069767
## 32           7 0.033914729
## 33           6 0.029069767
## 34           7 0.033914729
## 35           6 0.029069767
## 36           2 0.009689922
## 37           8 0.038759690
## 38           7 0.033914729
## 39           7 0.033914729
## 40          11 0.053294574
## 41           7 0.033914729
## 42           7 0.033914729
## 43           8 0.038759690
## 44           2 0.009689922
## 45           8 0.038759690
## 46           5 0.024224806
## 47          10 0.048449612
## 48           6 0.029069767
## 49           8 0.038759690
## 50          12 0.058139535
## 51           7 0.033914729
## 52          11 0.053294574
## 53           6 0.029069767
## 54           9 0.043604651
## 55          11 0.053294574
## 56          10 0.048449612
## 57          13 0.062984496
## 58           5 0.024224806
## 59           8 0.038759690
## 60           7 0.033914729
## 61           7 0.033914729
## 62           5 0.024224806
## 63           5 0.024224806
## 64           8 0.038759690
## 65           4 0.019379845
## 66           5 0.024224806
## 67           9 0.043604651
## 68          11 0.053294574
## 69           7 0.033914729
## 70          11 0.053294574
## 71          10 0.048449612
## 72           9 0.043604651
## 73          15 0.072674419
## 74           7 0.033914729
## 75          12 0.058139535
## 76           4 0.019379845
## 77          10 0.048449612
## 78           3 0.014534884
## 79           4 0.019379845
## 80          14 0.067829457
## 81           8 0.038759690
## 82           7 0.033914729
## 83          13 0.062984496
## 84          10 0.048449612
## 85           7 0.033914729
## 86           8 0.038759690
## 87          11 0.053294574
## 88           7 0.033914729
## 89           7 0.033914729
## 90          11 0.053294574
## 91           6 0.029069767
## 92           7 0.033914729
## 93          11 0.053294574
## 94           7 0.033914729
## 95           9 0.043604651
## 96          12 0.058139535
## 97          15 0.072674419
## 98           9 0.043604651
## 99           9 0.043604651
## 100         12 0.058139535
## 101          1 0.004844961
## 102          9 0.043604651
## 103         10 0.048449612
## 104         11 0.053294574
## 105          9 0.043604651
## 106         16 0.077519380
## 107         16 0.077519380
## 108         10 0.048449612
## 109         15 0.072674419
## 110         11 0.053294574
## 111          5 0.024224806
## 112         14 0.067829457
## 113         10 0.048449612
## 114         11 0.053294574
## 115         13 0.062984496
## 116          9 0.043604651
## 117          6 0.029069767
## 118          8 0.038759690
## 119         10 0.048449612
## 120          9 0.043604651
## 121         15 0.072674419
## 122          9 0.043604651
## 123         17 0.082364341
## 124         12 0.058139535
## 125          8 0.038759690
## 126         10 0.048449612
## 127         10 0.048449612
## 128         10 0.048449612
## 129         10 0.048449612
## 130         15 0.072674419
## 131         11 0.053294574
## 132         19 0.092054264
## 133         16 0.077519380
## 134         12 0.058139535
## 135         15 0.072674419
## 136         20 0.096899225
## 137         17 0.082364341
## 138         19 0.092054264
## 139         19 0.092054264
## 140         16 0.077519380
## 141         10 0.048449612
## 142         17 0.082364341
## 143         20 0.096899225
## 144         19 0.092054264
## 145         19 0.092054264
## 146         13 0.062984496
## 147         16 0.077519380
## 148         13 0.062984496
## 149         20 0.096899225
## 150         17 0.082364341
## 151         13 0.062984496
## 152         18 0.087209302
## 153         10 0.048449612
## 154         18 0.087209302
## 155         24 0.116279070
## 156         14 0.067829457
## 157         17 0.082364341
## 158         20 0.096899225
## 159         22 0.106589147
## 160         18 0.087209302
## 161         13 0.062984496
## 162         20 0.096899225
## 163         17 0.082364341
## 164         14 0.067829457
## 165         16 0.077519380
## 166         19 0.092054264
## 167         14 0.067829457
## 168         17 0.082364341
## 169         21 0.101744186
## 170         21 0.101744186
## 171         24 0.116279070
## 172         21 0.101744186
## 173         20 0.096899225
## 174         31 0.150193798
## 175         19 0.092054264
## 176         24 0.116279070
## 177         14 0.067829457
## 178         19 0.092054264
## 179         20 0.096899225
## 180         25 0.121124031
## 181         23 0.111434109
## 182         14 0.067829457
## 183         25 0.121124031
## 184         23 0.111434109
## 185         32 0.155038760
## 186         21 0.101744186
## 187         38 0.184108527
## 188         21 0.101744186
## 189         15 0.072674419
## 190         33 0.159883721
## 191         22 0.106589147
## 192         17 0.082364341
## 193         19 0.092054264
## 194         22 0.106589147
## 195         23 0.111434109
## 196         26 0.125968992
## 197         24 0.116279070
## 198         22 0.106589147
## 199         28 0.135658915
## 200         19 0.092054264
## 201         30 0.145348837
## 202         16 0.077519380
## 203         20 0.096899225
## 204         30 0.145348837
## 205         27 0.130813953
## 206         28 0.135658915
## 207         26 0.125968992
## 208         35 0.169573643
## 209         28 0.135658915
## 210         23 0.111434109
## 211         33 0.159883721
## 212         27 0.130813953
## 213         24 0.116279070
## 214         25 0.121124031
## 215         24 0.116279070
## 216         27 0.130813953
## 217         31 0.150193798
## 218         26 0.125968992
## 219         39 0.188953488
## 220         19 0.092054264
## 221         30 0.145348837
## 222         39 0.188953488
## 223         27 0.130813953
## 224         35 0.169573643
## 225         28 0.135658915
## 226         34 0.164728682
## 227         27 0.130813953
## 228         44 0.213178295
## 229         34 0.164728682
## 230         30 0.145348837
## 231         43 0.208333333
## 232         29 0.140503876
## 233         25 0.121124031
## 234         31 0.150193798
## 235         33 0.159883721
## 236         37 0.179263566
## 237         32 0.155038760
## 238         22 0.106589147
## 239         45 0.218023256
## 240         28 0.135658915
## 241         32 0.155038760
## 242         35 0.169573643
## 243         37 0.179263566
## 244         42 0.203488372
## 245         35 0.169573643
## 246         33 0.159883721
## 247         30 0.145348837
## 248         39 0.188953488
## 249         44 0.213178295
## 250         43 0.208333333
## 251         33 0.159883721
## 252         25 0.121124031
## 253         43 0.208333333
## 254         36 0.174418605
## 255         42 0.203488372
## 256         30 0.145348837
## 257         34 0.164728682
## 258         37 0.179263566
## 259         40 0.193798450
## 260         34 0.164728682
## 261         43 0.208333333
## 262         27 0.130813953
## 263         40 0.193798450
## 264         37 0.179263566
## 265         43 0.208333333
## 266         36 0.174418605
## 267         45 0.218023256
## 268         46 0.222868217
## 269         46 0.222868217
## 270         42 0.203488372
## 271         34 0.164728682
## 272         41 0.198643411
## 273         39 0.188953488
## 274         46 0.222868217
## 275         43 0.208333333
## 276         43 0.208333333
## 277         45 0.218023256
## 278         50 0.242248062
## 279         44 0.213178295
## 280         29 0.140503876
## 281         41 0.198643411
## 282         55 0.266472868
## 283         41 0.198643411
## 284         51 0.247093023
## 285         33 0.159883721
## 286         43 0.208333333
## 287         45 0.218023256
## 288         39 0.188953488
## 289         33 0.159883721
## 290         31 0.150193798
## 291         40 0.193798450
## 292         42 0.203488372
## 293         40 0.193798450
## 294         32 0.155038760
## 295         46 0.222868217
## 296         40 0.193798450
## 297         51 0.247093023
## 298         38 0.184108527
## 299         31 0.150193798
## 300         42 0.203488372
## 301         41 0.198643411
## 302         39 0.188953488
## 303         43 0.208333333
## 304         42 0.203488372
## 305         36 0.174418605
## 306         57 0.276162791
## 307         31 0.150193798
## 308         42 0.203488372
## 309         48 0.232558140
## 310         32 0.155038760
## 311         41 0.198643411
## 312         34 0.164728682
## 313         35 0.169573643
## 314         45 0.218023256
## 315         45 0.218023256
## 316         49 0.237403101
## 317         45 0.218023256
## 318         28 0.135658915
## 319         49 0.237403101
## 320         44 0.213178295
## 321         35 0.169573643
## 322         46 0.222868217
## 323         34 0.164728682
## 324         34 0.164728682
## 325         28 0.135658915
## 326         43 0.208333333
## 327         42 0.203488372
## 328         44 0.213178295
## 329         49 0.237403101
## 330         49 0.237403101
## 331         37 0.179263566
## 332         46 0.222868217
## 333         40 0.193798450
## 334         39 0.188953488
## 335         56 0.271317829
## 336         34 0.164728682
## 337         38 0.184108527
## 338         46 0.222868217
## 339         39 0.188953488
## 340         50 0.242248062
## 341         48 0.232558140
## 342         44 0.213178295
## 343         39 0.188953488
## 344         35 0.169573643
## 345         43 0.208333333
## 346         31 0.150193798
## 347         43 0.208333333
## 348         33 0.159883721
## 349         30 0.145348837
## 350         45 0.218023256
## 351         42 0.203488372
## 352         46 0.222868217
## 353         38 0.184108527
## 354         44 0.213178295
## 355         36 0.174418605
## 356         40 0.193798450
## 357         47 0.227713178
## 358         34 0.164728682
## 359         40 0.193798450
## 360         33 0.159883721
## 361         26 0.125968992
## 362         50 0.242248062
## 363         46 0.222868217
## 364         33 0.159883721
## 365         45 0.218023256
## 366         39 0.188953488
## 367         42 0.203488372
## 368         40 0.193798450
## 369         40 0.193798450
## 370         39 0.188953488
## 371         36 0.174418605
## 372         40 0.193798450
## 373         40 0.193798450
## 374         44 0.213178295
## 375         53 0.256782946
## 376         26 0.125968992
## 377         48 0.232558140
## 378         34 0.164728682
## 379         34 0.164728682
## 380         50 0.242248062
## 381         32 0.155038760
## 382         40 0.193798450
## 383         31 0.150193798
## 384         32 0.155038760
## 385         41 0.198643411
## 386         56 0.271317829
## 387         39 0.188953488
## 388         38 0.184108527
## 389         46 0.222868217
## 390         39 0.188953488
## 391         41 0.198643411
## 392         29 0.140503876
## 393         35 0.169573643
## 394         32 0.155038760
## 395         35 0.169573643
## 396         28 0.135658915
## 397         39 0.188953488
## 398         34 0.164728682
## 399         43 0.208333333
## 400         39 0.188953488
## 401         34 0.164728682
## 402         31 0.150193798
## 403         44 0.213178295
## 404         29 0.140503876
## 405         34 0.164728682
## 406         41 0.198643411
## 407         37 0.179263566
## 408         36 0.174418605
## 409         37 0.179263566
## 410         46 0.222868217
## 411         36 0.174418605
## 412         34 0.164728682
## 413         21 0.101744186
## 414         38 0.184108527
## 415         34 0.164728682
## 416         34 0.164728682
## 417         34 0.164728682
## 418         35 0.169573643
## 419         38 0.184108527
## 420         32 0.155038760
## 421         23 0.111434109
## 422         35 0.169573643
## 423         41 0.198643411
## 424         46 0.222868217
## 425         34 0.164728682
## 426         48 0.232558140
## 427         33 0.159883721
## 428         41 0.198643411
## 429         54 0.261627907
## 430         26 0.125968992
## 431         31 0.150193798
## 432         32 0.155038760
## 433         37 0.179263566
## 434         27 0.130813953
## 435         43 0.208333333
## 436         28 0.135658915
## 437         33 0.159883721
## 438         35 0.169573643
## 439         36 0.174418605
## 440         24 0.116279070
## 441         31 0.150193798
## 442         33 0.159883721
## 443         40 0.193798450
## 444         28 0.135658915
## 445         37 0.179263566
## 446         27 0.130813953
## 447         32 0.155038760
## 448         35 0.169573643
## 449         32 0.155038760
## 450         30 0.145348837
## 451         29 0.140503876
## 452         35 0.169573643
## 453         36 0.174418605
## 454         27 0.130813953
## 455         30 0.145348837
## 456         34 0.164728682
## 457         32 0.155038760
## 458         33 0.159883721
## 459         35 0.169573643
## 460         28 0.135658915
## 461         28 0.135658915
## 462         22 0.106589147
## 463         31 0.150193798
## 464         35 0.169573643
## 465         32 0.155038760
## 466         25 0.121124031
## 467         41 0.198643411
## 468         23 0.111434109
## 469         22 0.106589147
## 470         34 0.164728682
## 471         25 0.121124031
## 472         38 0.184108527
## 473         17 0.082364341
## 474         33 0.159883721
## 475         27 0.130813953
## 476         25 0.121124031
## 477         26 0.125968992
## 478         29 0.140503876
## 479         27 0.130813953
## 480         32 0.155038760
## 481         35 0.169573643
## 482         31 0.150193798
## 483         32 0.155038760
## 484         37 0.179263566
## 485         29 0.140503876
## 486         25 0.121124031
## 487         24 0.116279070
## 488         38 0.184108527
## 489         21 0.101744186
## 490         24 0.116279070
## 491         25 0.121124031
## 492         30 0.145348837
## 493         25 0.121124031
## 494         25 0.121124031
## 495         17 0.082364341
## 496         23 0.111434109
## 497         28 0.135658915
## 498         32 0.155038760
## 499         31 0.150193798
## 500         30 0.145348837
## 501         30 0.145348837
## 502         23 0.111434109
## 503         34 0.164728682
## 504         29 0.140503876
## 505         20 0.096899225
## 506         26 0.125968992
## 507         29 0.140503876
## 508         16 0.077519380
## 509         29 0.140503876
## 510         35 0.169573643
## 511         18 0.087209302
## 512         34 0.164728682
## 513         20 0.096899225
## 514         26 0.125968992
## 515         26 0.125968992
## 516         25 0.121124031
## 517         16 0.077519380
## 518         24 0.116279070
## 519         23 0.111434109
## 520         30 0.145348837
## 521         25 0.121124031
## 522         32 0.155038760
## 523         26 0.125968992
## 524         23 0.111434109
## 525         24 0.116279070
## 526         17 0.082364341
## 527         25 0.121124031
## 528         23 0.111434109
## 529         27 0.130813953
## 530         31 0.150193798
## 531         18 0.087209302
## 532         27 0.130813953
## 533         20 0.096899225
## 534         12 0.058139535
## 535         36 0.174418605
## 536         25 0.121124031
## 537         20 0.096899225
## 538         28 0.135658915
## 539         20 0.096899225
## 540         29 0.140503876
## 541         22 0.106589147
## 542         15 0.072674419
## 543         26 0.125968992
## 544         30 0.145348837
## 545         30 0.145348837
## 546         18 0.087209302
## 547         14 0.067829457
## 548         21 0.101744186
## 549         20 0.096899225
## 550         25 0.121124031
## 551         20 0.096899225
## 552         15 0.072674419
## 553         18 0.087209302
## 554         20 0.096899225
## 555         22 0.106589147
## 556         20 0.096899225
## 557         32 0.155038760
## 558         12 0.058139535
## 559         25 0.121124031
## 560         22 0.106589147
## 561         20 0.096899225
## 562         27 0.130813953
## 563         18 0.087209302
## 564         21 0.101744186
## 565         16 0.077519380
## 566         18 0.087209302
## 567         24 0.116279070
## 568         34 0.164728682
## 569         18 0.087209302
## 570         19 0.092054264
## 571         21 0.101744186
## 572         16 0.077519380
## 573         21 0.101744186
## 574         20 0.096899225
## 575         15 0.072674419
## 576         26 0.125968992
## 577         19 0.092054264
## 578         18 0.087209302
## 579         18 0.087209302
## 580         21 0.101744186
## 581         30 0.145348837
## 582         20 0.096899225
## 583         16 0.077519380
## 584         14 0.067829457
## 585         19 0.092054264
## 586         17 0.082364341
## 587         17 0.082364341
## 588         23 0.111434109
## 589         18 0.087209302
## 590         24 0.116279070
## 591         18 0.087209302
## 592         17 0.082364341
## 593         25 0.121124031
## 594         19 0.092054264
## 595         21 0.101744186
## 596         15 0.072674419
## 597         27 0.130813953
## 598         20 0.096899225
## 599         13 0.062984496
## 600         15 0.072674419
## 601         16 0.077519380
## 602         16 0.077519380
## 603         20 0.096899225
## 604          9 0.043604651
## 605         12 0.058139535
## 606         24 0.116279070
## 607         27 0.130813953
## 608         22 0.106589147
## 609         19 0.092054264
## 610         14 0.067829457
## 611         18 0.087209302
## 612         17 0.082364341
## 613         17 0.082364341
## 614         30 0.145348837
## 615         17 0.082364341
## 616         14 0.067829457
## 617         15 0.072674419
## 618         21 0.101744186
## 619         20 0.096899225
## 620         24 0.116279070
## 621         19 0.092054264
## 622         17 0.082364341
## 623         26 0.125968992
## 624         13 0.062984496
## 625         17 0.082364341
## 626         23 0.111434109
## 627         14 0.067829457
## 628         19 0.092054264
## 629         19 0.092054264
## 630         12 0.058139535
## 631         23 0.111434109
## 632         19 0.092054264
## 633         19 0.092054264
## 634         15 0.072674419
## 635         10 0.048449612
## 636         18 0.087209302
## 637          6 0.029069767
## 638         13 0.062984496
## 639         15 0.072674419
## 640         17 0.082364341
## 641         15 0.072674419
## 642         19 0.092054264
## 643         15 0.072674419
## 644         11 0.053294574
## 645         11 0.053294574
## 646         13 0.062984496
## 647         22 0.106589147
## 648         22 0.106589147
## 649         11 0.053294574
## 650         10 0.048449612
## 651         14 0.067829457
## 652         17 0.082364341
## 653         13 0.062984496
## 654         18 0.087209302
## 655         10 0.048449612
## 656         11 0.053294574
## 657         16 0.077519380
## 658         13 0.062984496
## 659         19 0.092054264
## 660         19 0.092054264
## 661         12 0.058139535
## 662         19 0.092054264
## 663         17 0.082364341
## 664         16 0.077519380
## 665         15 0.072674419
## 666         20 0.096899225
## 667         13 0.062984496
## 668         15 0.072674419
## 669         14 0.067829457
## 670         12 0.058139535
## 671         13 0.062984496
## 672         12 0.058139535
## 673         18 0.087209302
## 674         12 0.058139535
## 675         15 0.072674419
## 676         14 0.067829457
## 677         10 0.048449612
## 678          6 0.029069767
## 679         16 0.077519380
## 680         15 0.072674419
## 681         12 0.058139535
## 682         14 0.067829457
## 683          7 0.033914729
## 684         15 0.072674419
## 685         14 0.067829457
## 686         10 0.048449612
## 687         14 0.067829457
## 688         10 0.048449612
## 689          7 0.033914729
## 690          9 0.043604651
## 691          9 0.043604651
## 692          9 0.043604651
## 693         12 0.058139535
## 694         18 0.087209302
## 695         15 0.072674419
## 696         17 0.082364341
## 697         19 0.092054264
## 698          7 0.033914729
## 699         13 0.062984496
## 700          9 0.043604651
## 701          7 0.033914729
## 702         13 0.062984496
## 703         17 0.082364341
## 704         11 0.053294574
## 705         18 0.087209302
## 706         12 0.058139535
## 707          8 0.038759690
## 708          9 0.043604651
## 709         12 0.058139535
## 710         11 0.053294574
## 711          7 0.033914729
## 712         15 0.072674419
## 713         15 0.072674419
## 714         11 0.053294574
## 715         15 0.072674419
## 716         10 0.048449612
## 717          5 0.024224806
## 718         23 0.111434109
## 719         11 0.053294574
## 720         14 0.067829457
## 721         17 0.082364341
## 722         12 0.058139535
## 723         12 0.058139535
## 724         14 0.067829457
## 725         18 0.087209302
## 726          8 0.038759690
## 727         11 0.053294574
## 728         12 0.058139535
## 729         10 0.048449612
## 730          9 0.043604651
## 731         12 0.058139535
## 732          9 0.043604651
## 733          8 0.038759690
## 734         15 0.072674419
## 735          6 0.029069767
## 736         14 0.067829457
## 737         17 0.082364341
## 738         12 0.058139535
## 739         10 0.048449612
## 740         12 0.058139535
## 741         10 0.048449612
## 742         12 0.058139535
## 743         15 0.072674419
## 744         10 0.048449612
## 745          9 0.043604651
## 746         13 0.062984496
## 747         11 0.053294574
## 748          5 0.024224806
## 749          7 0.033914729
## 750          8 0.038759690
## 751          6 0.029069767
## 752          8 0.038759690
## 753         12 0.058139535
## 754         13 0.062984496
## 755          5 0.024224806
## 756          9 0.043604651
## 757          8 0.038759690
## 758         14 0.067829457
## 759          9 0.043604651
## 760          4 0.019379845
## 761          9 0.043604651
## 762         10 0.048449612
## 763         16 0.077519380
## 764         12 0.058139535
## 765         13 0.062984496
## 766          9 0.043604651
## 767          6 0.029069767
## 768          6 0.029069767
## 769         15 0.072674419
## 770         14 0.067829457
## 771          6 0.029069767
## 772          8 0.038759690
## 773         13 0.062984496
## 774          9 0.043604651
## 775         12 0.058139535
## 776          5 0.024224806
## 777          8 0.038759690
## 778         13 0.062984496
## 779          8 0.038759690
## 780          9 0.043604651
## 781         11 0.053294574
## 782          9 0.043604651
## 783         10 0.048449612
## 784         10 0.048449612
## 785          6 0.029069767
## 786          2 0.009689922
## 787         10 0.048449612
## 788         11 0.053294574
## 789         10 0.048449612
## 790          9 0.043604651
## 791          3 0.014534884
## 792         11 0.053294574
## 793          9 0.043604651
## 794         10 0.048449612
## 795         13 0.062984496
## 796         11 0.053294574
## 797          8 0.038759690
## 798          9 0.043604651
## 799          3 0.014534884
## 800         11 0.053294574
## 801         10 0.048449612
## 802          7 0.033914729
## 803          5 0.024224806
## 804          6 0.029069767
## 805          7 0.033914729
## 806         10 0.048449612
## 807         11 0.053294574
## 808          9 0.043604651
## 809          3 0.014534884
## 810         13 0.062984496
## 811          3 0.014534884
## 812          9 0.043604651
## 813          8 0.038759690
## 814          5 0.024224806
## 815         10 0.048449612
## 816          7 0.033914729
## 817         14 0.067829457
## 818          4 0.019379845
## 819          6 0.029069767
## 820          3 0.014534884
## 821          4 0.019379845
## 822          2 0.009689922
## 823          7 0.033914729
## 824          9 0.043604651
## 825          8 0.038759690
## 826          2 0.009689922
## 827          7 0.033914729
## 828          7 0.033914729
## 829          8 0.038759690
## 830         11 0.053294574
## 831          6 0.029069767
## 832         10 0.048449612
## 833          5 0.024224806
## 834          9 0.043604651
## 835          6 0.029069767
## 836          8 0.038759690
## 837          4 0.019379845
## 838         11 0.053294574
## 839          9 0.043604651
## 840          7 0.033914729
## 841         12 0.058139535
## 842          6 0.029069767
## 843         13 0.062984496
## 844          2 0.009689922
## 845          7 0.033914729
## 846          9 0.043604651
## 847          7 0.033914729
## 848          4 0.019379845
## 849          4 0.019379845
## 850         10 0.048449612
## 851          4 0.019379845
## 852          5 0.024224806
## 853          7 0.033914729
## 854          6 0.029069767
## 855          8 0.038759690
## 856          5 0.024224806
## 857          5 0.024224806
## 858          4 0.019379845
## 859          6 0.029069767
## 860          6 0.029069767
## 861          6 0.029069767
## 862          7 0.033914729
## 863          5 0.024224806
## 864          4 0.019379845
## 865          4 0.019379845
## 866          5 0.024224806
## 867          7 0.033914729
## 868          5 0.024224806
## 869          3 0.014534884
## 870          9 0.043604651
## 871          6 0.029069767
## 872          4 0.019379845
## 873          5 0.024224806
## 874          9 0.043604651
## 875          3 0.014534884
## 876          8 0.038759690
## 877          5 0.024224806
## 878          3 0.014534884
## 879          6 0.029069767
## 880          5 0.024224806
## 881         10 0.048449612
## 882          3 0.014534884
## 883          5 0.024224806
## 884          4 0.019379845
## 885          5 0.024224806
## 886          3 0.014534884
## 887          9 0.043604651
## 888          8 0.038759690
## 889          2 0.009689922
## 890          8 0.038759690
## 891          3 0.014534884
## 892          7 0.033914729
## 893         10 0.048449612
## 894          6 0.029069767
## 895          6 0.029069767
## 896          5 0.024224806
## 897          2 0.009689922
## 898          3 0.014534884
## 899          4 0.019379845
## 900          3 0.014534884
## 901          5 0.024224806
## 902          5 0.024224806
## 903          4 0.019379845
## 904          9 0.043604651
## 905          6 0.029069767
## 906          4 0.019379845
## 907          3 0.014534884
## 908          2 0.009689922
## 909          5 0.024224806
## 910          4 0.019379845
## 911          4 0.019379845
## 912          5 0.024224806
## 913          3 0.014534884
## 914          6 0.029069767
## 915          8 0.038759690
## 916          2 0.009689922
## 917          3 0.014534884
## 918          5 0.024224806
## 919          8 0.038759690
## 920          5 0.024224806
## 921          5 0.024224806
## 922          3 0.014534884
## 923          8 0.038759690
## 924          5 0.024224806
## 925          2 0.009689922
## 926          2 0.009689922
## 927          3 0.014534884
## 928          3 0.014534884
## 930          5 0.024224806
## 931          5 0.024224806
## 932          8 0.038759690
## 933          3 0.014534884
## 934          5 0.024224806
## 935          7 0.033914729
## 936          5 0.024224806
## 937          5 0.024224806
## 938          4 0.019379845
## 939          3 0.014534884
## 940          4 0.019379845
## 941          4 0.019379845
## 942          3 0.014534884
## 943          7 0.033914729
## 944          6 0.029069767
## 945          6 0.029069767
## 946          4 0.019379845
## 947          7 0.033914729
## 948          5 0.024224806
## 949          6 0.029069767
## 950          7 0.033914729
## 951          1 0.004844961
## 952          5 0.024224806
## 953          7 0.033914729
## 954          7 0.033914729
## 955          6 0.029069767
## 956          5 0.024224806
## 957          9 0.043604651
## 958          3 0.014534884
## 959          5 0.024224806
## 960          5 0.024224806
## 961          4 0.019379845
## 962          7 0.033914729
## 963          7 0.033914729
## 964          5 0.024224806
## 965          3 0.014534884
## 966          4 0.019379845
## 967          3 0.014534884
## 968          3 0.014534884
## 969          4 0.019379845
## 970          7 0.033914729
## 971          6 0.029069767
## 972          7 0.033914729
## 973          3 0.014534884
## 974          1 0.004844961
## 975          5 0.024224806
## 976          2 0.009689922
## 977          8 0.038759690
## 978          7 0.033914729
## 979          5 0.024224806
## 980          7 0.033914729
## 981          2 0.009689922
## 982          6 0.029069767
## 983          7 0.033914729
## 984          5 0.024224806
## 985          3 0.014534884
## 986          5 0.024224806
## 987          4 0.019379845
## 988          4 0.019379845
## 989          2 0.009689922
## 990          3 0.014534884
## 991          4 0.019379845
## 992          1 0.004844961
## 993          7 0.033914729
## 994          4 0.019379845
## 995          3 0.014534884
## 996          2 0.009689922
## 997          8 0.038759690
## 998          4 0.019379845
## 999          2 0.009689922
## 1000         8 0.038759690
## 1001         6 0.029069767
## 1002         6 0.029069767
## 1004         4 0.019379845
## 1005         3 0.014534884
## 1006         4 0.019379845
## 1007         5 0.024224806
## 1008         5 0.024224806
## 1009         5 0.024224806
## 1010         5 0.024224806
## 1011         3 0.014534884
## 1012         6 0.029069767
## 1013         1 0.004844961
## 1014         5 0.024224806
## 1015         2 0.009689922
## 1016         5 0.024224806
## 1017         3 0.014534884
## 1018         4 0.019379845
## 1019         4 0.019379845
## 1020         3 0.014534884
## 1021         4 0.019379845
## 1022         2 0.009689922
## 1023         3 0.014534884
## 1024         3 0.014534884
## 1025         4 0.019379845
## 1026         3 0.014534884
## 1027         6 0.029069767
## 1028         3 0.014534884
## 1029         5 0.024224806
## 1030         4 0.019379845
## 1031         4 0.019379845
## 1032         1 0.004844961
## 1033         5 0.024224806
## 1034         4 0.019379845
## 1035         5 0.024224806
## 1036         8 0.038759690
## 1037         5 0.024224806
## 1038         3 0.014534884
## 1040         2 0.009689922
## 1041         4 0.019379845
## 1042         4 0.019379845
## 1043         6 0.029069767
## 1044         2 0.009689922
## 1045         3 0.014534884
## 1046         4 0.019379845
## 1047         6 0.029069767
## 1048         1 0.004844961
## 1049         4 0.019379845
## 1050         2 0.009689922
## 1051         2 0.009689922
## 1052         2 0.009689922
## 1053         4 0.019379845
## 1054         3 0.014534884
## 1055         4 0.019379845
## 1056         4 0.019379845
## 1057         8 0.038759690
## 1058         5 0.024224806
## 1059         4 0.019379845
## 1060         2 0.009689922
## 1061         3 0.014534884
## 1062         3 0.014534884
## 1063         6 0.029069767
## 1064         4 0.019379845
## 1065         3 0.014534884
## 1066         1 0.004844961
## 1067         3 0.014534884
## 1068         4 0.019379845
## 1070         4 0.019379845
## 1071         1 0.004844961
## 1072         6 0.029069767
## 1073         4 0.019379845
## 1074         2 0.009689922
## 1075         5 0.024224806
## 1076         3 0.014534884
## 1077         5 0.024224806
## 1078         3 0.014534884
## 1079         1 0.004844961
## 1080         1 0.004844961
## 1081         3 0.014534884
## 1083         6 0.029069767
## 1084         2 0.009689922
## 1086         2 0.009689922
## 1087         3 0.014534884
## 1088         7 0.033914729
## 1089         2 0.009689922
## 1090         2 0.009689922
## 1091         2 0.009689922
## 1092         4 0.019379845
## 1093         2 0.009689922
## 1094         4 0.019379845
## 1096         3 0.014534884
## 1097         2 0.009689922
## 1098         6 0.029069767
## 1099         1 0.004844961
## 1100         4 0.019379845
## 1101         2 0.009689922
## 1102         3 0.014534884
## 1103         1 0.004844961
## 1104         3 0.014534884
## 1105         4 0.019379845
## 1106         3 0.014534884
## 1107         4 0.019379845
## 1108         1 0.004844961
## 1109         5 0.024224806
## 1110         2 0.009689922
## 1112         2 0.009689922
## 1113         5 0.024224806
## 1114         1 0.004844961
## 1115         6 0.029069767
## 1116         4 0.019379845
## 1117         5 0.024224806
## 1118         3 0.014534884
## 1119         2 0.009689922
## 1120         1 0.004844961
## 1121         3 0.014534884
## 1122         2 0.009689922
## 1123         2 0.009689922
## 1124         6 0.029069767
## 1125         3 0.014534884
## 1126         2 0.009689922
## 1127         1 0.004844961
## 1128         4 0.019379845
## 1129         1 0.004844961
## 1130         4 0.019379845
## 1131        11 0.053294574
## 1132         2 0.009689922
## 1133         1 0.004844961
## 1134         4 0.019379845
## 1135         3 0.014534884
## 1136         2 0.009689922
## 1137         1 0.004844961
## 1138         5 0.024224806
## 1139         8 0.038759690
## 1140         1 0.004844961
## 1141         5 0.024224806
## 1142         2 0.009689922
## 1143         1 0.004844961
## 1144         2 0.009689922
## 1145         1 0.004844961
## 1146         4 0.019379845
## 1147         3 0.014534884
## 1148         1 0.004844961
## 1149         1 0.004844961
## 1150         4 0.019379845
## 1151         4 0.019379845
## 1152         1 0.004844961
## 1153         1 0.004844961
## 1154         1 0.004844961
## 1157         1 0.004844961
## 1158         3 0.014534884
## 1159         4 0.019379845
## 1161         2 0.009689922
## 1162         5 0.024224806
## 1163         4 0.019379845
## 1164         1 0.004844961
## 1165         3 0.014534884
## 1166         1 0.004844961
## 1167         2 0.009689922
## 1168         1 0.004844961
## 1169         2 0.009689922
## 1170         2 0.009689922
## 1171         1 0.004844961
## 1172         2 0.009689922
## 1174         2 0.009689922
## 1175         1 0.004844961
## 1176         2 0.009689922
## 1177         3 0.014534884
## 1178         4 0.019379845
## 1179         4 0.019379845
## 1180         3 0.014534884
## 1182         2 0.009689922
## 1183         1 0.004844961
## 1184         1 0.004844961
## 1185         2 0.009689922
## 1186         1 0.004844961
## 1187         2 0.009689922
## 1188         2 0.009689922
## 1189         5 0.024224806
## 1190         1 0.004844961
## 1191         3 0.014534884
## 1192         1 0.004844961
## 1193         2 0.009689922
## 1195         3 0.014534884
## 1196         5 0.024224806
## 1197         2 0.009689922
## 1198         5 0.024224806
## 1199         4 0.019379845
## 1200         3 0.014534884
## 1201         1 0.004844961
## 1202         3 0.014534884
## 1204         2 0.009689922
## 1205         3 0.014534884
## 1208         1 0.004844961
## 1209         2 0.009689922
## 1210         3 0.014534884
## 1211         1 0.004844961
## 1212         3 0.014534884
## 1213         3 0.014534884
## 1214         2 0.009689922
## 1215         1 0.004844961
## 1216         2 0.009689922
## 1217         4 0.019379845
## 1218         1 0.004844961
## 1219         2 0.009689922
## 1220         3 0.014534884
## 1221         2 0.009689922
## 1222         2 0.009689922
## 1223         1 0.004844961
## 1224         4 0.019379845
## 1225         1 0.004844961
## 1226         2 0.009689922
## 1227         5 0.024224806
## 1228         2 0.009689922
## 1229         6 0.029069767
## 1231         2 0.009689922
## 1232         3 0.014534884
## 1233         2 0.009689922
## 1235         4 0.019379845
## 1236         1 0.004844961
## 1238         3 0.014534884
## 1239         3 0.014534884
## 1240         3 0.014534884
## 1241         4 0.019379845
## 1242         2 0.009689922
## 1243         5 0.024224806
## 1244         1 0.004844961
## 1245         2 0.009689922
## 1247         2 0.009689922
## 1248         3 0.014534884
## 1249         2 0.009689922
## 1250         6 0.029069767
## 1251         2 0.009689922
## 1252         2 0.009689922
## 1253         2 0.009689922
## 1255         1 0.004844961
## 1257         3 0.014534884
## 1258         2 0.009689922
## 1259         1 0.004844961
## 1260         1 0.004844961
## 1261         1 0.004844961
## 1262         5 0.024224806
## 1264         3 0.014534884
## 1265         6 0.029069767
## 1266         3 0.014534884
## 1267         4 0.019379845
## 1268         3 0.014534884
## 1269         2 0.009689922
## 1270         2 0.009689922
## 1271         4 0.019379845
## 1272         3 0.014534884
## 1273         2 0.009689922
## 1274         2 0.009689922
## 1275         1 0.004844961
## 1276         1 0.004844961
## 1278         1 0.004844961
## 1279         3 0.014534884
## 1280         1 0.004844961
## 1281         1 0.004844961
## 1283         2 0.009689922
## 1285         1 0.004844961
## 1286         3 0.014534884
## 1287         1 0.004844961
## 1288         2 0.009689922
## 1289         1 0.004844961
## 1290         1 0.004844961
## 1291         1 0.004844961
## 1292         1 0.004844961
## 1293         2 0.009689922
## 1294         4 0.019379845
## 1295         2 0.009689922
## 1296         2 0.009689922
## 1297         1 0.004844961
## 1298         1 0.004844961
## 1299         6 0.029069767
## 1300         2 0.009689922
## 1304         3 0.014534884
## 1305         1 0.004844961
## 1307         2 0.009689922
## 1308         3 0.014534884
## 1309         1 0.004844961
## 1310         3 0.014534884
## 1312         1 0.004844961
## 1313         1 0.004844961
## 1314         1 0.004844961
## 1315         1 0.004844961
## 1316         5 0.024224806
## 1318         4 0.019379845
## 1321         2 0.009689922
## 1322         1 0.004844961
## 1323         1 0.004844961
## 1326         1 0.004844961
## 1327         3 0.014534884
## 1329         2 0.009689922
## 1331         1 0.004844961
## 1332         1 0.004844961
## 1333         2 0.009689922
## 1334         3 0.014534884
## 1335         3 0.014534884
## 1336         1 0.004844961
## 1337         3 0.014534884
## 1338         1 0.004844961
## 1339         2 0.009689922
## 1340         2 0.009689922
## 1341         2 0.009689922
## 1342         1 0.004844961
## 1345         1 0.004844961
## 1347         1 0.004844961
## 1348         2 0.009689922
## 1349         1 0.004844961
## 1350         1 0.004844961
## 1351         1 0.004844961
## 1352         2 0.009689922
## 1356         1 0.004844961
## 1357         2 0.009689922
## 1359         1 0.004844961
## 1362         2 0.009689922
## 1365         3 0.014534884
## 1367         2 0.009689922
## 1369         1 0.004844961
## 1370         3 0.014534884
## 1371         3 0.014534884
## 1373         1 0.004844961
## 1374         3 0.014534884
## 1375         1 0.004844961
## 1376         2 0.009689922
## 1377         2 0.009689922
## 1378         1 0.004844961
## 1379         1 0.004844961
## 1380         1 0.004844961
## 1381         1 0.004844961
## 1383         1 0.004844961
## 1385         1 0.004844961
## 1386         1 0.004844961
## 1387         3 0.014534884
## 1389         3 0.014534884
## 1390         1 0.004844961
## 1391         1 0.004844961
## 1392         1 0.004844961
## 1393         3 0.014534884
## 1394         2 0.009689922
## 1395         2 0.009689922
## 1396         3 0.014534884
## 1397         3 0.014534884
## 1399         1 0.004844961
## 1401         1 0.004844961
## 1402         1 0.004844961
## 1404         2 0.009689922
## 1405         3 0.014534884
## 1406         1 0.004844961
## 1408         1 0.004844961
## 1409         1 0.004844961
## 1410         1 0.004844961
## 1411         1 0.004844961
## 1412         1 0.004844961
## 1414         2 0.009689922
## 1415         1 0.004844961
## 1418         1 0.004844961
## 1419         1 0.004844961
## 1420         1 0.004844961
## 1421         1 0.004844961
## 1423         3 0.014534884
## 1427         2 0.009689922
## 1429         3 0.014534884
## 1430         1 0.004844961
## 1432         1 0.004844961
## 1433         1 0.004844961
## 1435         1 0.004844961
## 1436         1 0.004844961
## 1437         1 0.004844961
## 1438         1 0.004844961
## 1439         2 0.009689922
## 1442         1 0.004844961
## 1444         2 0.009689922
## 1445         1 0.004844961
## 1446         1 0.004844961
## 1447         1 0.004844961
## 1449         2 0.009689922
## 1450         2 0.009689922
## 1451         5 0.024224806
## 1453         3 0.014534884
## 1455         1 0.004844961
## 1456         2 0.009689922
## 1457         3 0.014534884
## 1458         4 0.019379845
## 1459         1 0.004844961
## 1460         1 0.004844961
## 1462         1 0.004844961
## 1463         2 0.009689922
## 1464         1 0.004844961
## 1465         1 0.004844961
## 1466         4 0.019379845
## 1467         1 0.004844961
## 1468         2 0.009689922
## 1469         1 0.004844961
## 1470         3 0.014534884
## 1472         2 0.009689922
## 1473         2 0.009689922
## 1474         2 0.009689922
## 1475         1 0.004844961
## 1477         1 0.004844961
## 1480         2 0.009689922
## 1481         3 0.014534884
## 1482         4 0.019379845
## 1483         2 0.009689922
## 1484         2 0.009689922
## 1486         1 0.004844961
## 1491         2 0.009689922
## 1492         2 0.009689922
## 1493         1 0.004844961
## 1494         3 0.014534884
## 1495         1 0.004844961
## 1496         3 0.014534884
## 1497         3 0.014534884
## 1498         1 0.004844961
## 1499         1 0.004844961
## 1500         2 0.009689922
## 1501         1 0.004844961
## 1502         3 0.014534884
## 1503         1 0.004844961
## 1504         2 0.009689922
## 1505         2 0.009689922
## 1506         1 0.004844961
## 1507         1 0.004844961
## 1509         3 0.014534884
## 1511         1 0.004844961
## 1513         1 0.004844961
## 1514         1 0.004844961
## 1516         1 0.004844961
## 1517         1 0.004844961
## 1519         1 0.004844961
## 1520         4 0.019379845
## 1521         1 0.004844961
## 1523         1 0.004844961
## 1524         5 0.024224806
## 1526         1 0.004844961
## 1527         1 0.004844961
## 1529         2 0.009689922
## 1534         3 0.014534884
## 1535         3 0.014534884
## 1536         1 0.004844961
## 1537         2 0.009689922
## 1538         2 0.009689922
## 1539         1 0.004844961
## 1544         1 0.004844961
## 1546         1 0.004844961
## 1549         2 0.009689922
## 1550         1 0.004844961
## 1553         1 0.004844961
## 1554         5 0.024224806
## 1555         2 0.009689922
## 1557         1 0.004844961
## 1558         1 0.004844961
## 1560         1 0.004844961
## 1565         1 0.004844961
## 1566         1 0.004844961
## 1567         1 0.004844961
## 1568         1 0.004844961
## 1570         1 0.004844961
## 1571         1 0.004844961
## 1574         2 0.009689922
## 1575         2 0.009689922
## 1576         1 0.004844961
## 1577         1 0.004844961
## 1580         3 0.014534884
## 1581         3 0.014534884
## 1582         3 0.014534884
## 1583         1 0.004844961
## 1584         1 0.004844961
## 1585         2 0.009689922
## 1589         1 0.004844961
## 1591         1 0.004844961
## 1593         1 0.004844961
## 1594         1 0.004844961
## 1595         1 0.004844961
## 1596         2 0.009689922
## 1597         2 0.009689922
## 1598         1 0.004844961
## 1599         1 0.004844961
## 1600         1 0.004844961
## 1605         2 0.009689922
## 1606         1 0.004844961
## 1610         1 0.004844961
## 1612         1 0.004844961
## 1616         1 0.004844961
## 1621         4 0.019379845
## 1622         2 0.009689922
## 1623         2 0.009689922
## 1625         1 0.004844961
## 1627         2 0.009689922
## 1629         2 0.009689922
## 1630         1 0.004844961
## 1632         2 0.009689922
## 1634         2 0.009689922
## 1635         1 0.004844961
## 1639         1 0.004844961
## 1644         3 0.014534884
## 1646         1 0.004844961
## 1648         1 0.004844961
## 1649         2 0.009689922
## 1651         1 0.004844961
## 1652         1 0.004844961
## 1653         3 0.014534884
## 1661         3 0.014534884
## 1666         1 0.004844961
## 1667         1 0.004844961
## 1668         1 0.004844961
## 1671         1 0.004844961
## 1672         1 0.004844961
## 1673         1 0.004844961
## 1674         1 0.004844961
## 1680         1 0.004844961
## 1683         1 0.004844961
## 1689         1 0.004844961
## 1691         1 0.004844961
## 1692         1 0.004844961
## 1693         1 0.004844961
## 1694         2 0.009689922
## 1696         1 0.004844961
## 1697         2 0.009689922
## 1698         2 0.009689922
## 1699         1 0.004844961
## 1703         1 0.004844961
## 1705         1 0.004844961
## 1707         1 0.004844961
## 1710         1 0.004844961
## 1712         2 0.009689922
## 1715         1 0.004844961
## 1717         2 0.009689922
## 1718         1 0.004844961
## 1722         2 0.009689922
## 1724         1 0.004844961
## 1729         1 0.004844961
## 1734         1 0.004844961
## 1735         2 0.009689922
## 1740         1 0.004844961
## 1742         1 0.004844961
## 1743         1 0.004844961
## 1745         1 0.004844961
## 1747         1 0.004844961
## 1749         2 0.009689922
## 1752         2 0.009689922
## 1753         1 0.004844961
## 1755         2 0.009689922
## 1759         1 0.004844961
## 1761         1 0.004844961
## 1763         1 0.004844961
## 1765         1 0.004844961
## 1767         1 0.004844961
## 1772         2 0.009689922
## 1773         1 0.004844961
## 1775         1 0.004844961
## 1777         1 0.004844961
## 1778         1 0.004844961
## 1780         1 0.004844961
## 1781         2 0.009689922
## 1789         4 0.019379845
## 1790         2 0.009689922
## 1791         1 0.004844961
## 1796         1 0.004844961
## 1797         2 0.009689922
## 1804         1 0.004844961
## 1806         1 0.004844961
## 1807         1 0.004844961
## 1808         1 0.004844961
## 1809         1 0.004844961
## 1811         1 0.004844961
## 1812         1 0.004844961
## 1815         1 0.004844961
## 1816         1 0.004844961
## 1818         1 0.004844961
## 1820         1 0.004844961
## 1822         1 0.004844961
## 1823         1 0.004844961
## 1827         1 0.004844961
## 1831         1 0.004844961
## 1832         1 0.004844961
## 1837         1 0.004844961
## 1838         1 0.004844961
## 1840         1 0.004844961
## 1843         1 0.004844961
## 1844         2 0.009689922
## 1845         2 0.009689922
## 1853         2 0.009689922
## 1855         1 0.004844961
## 1856         1 0.004844961
## 1858         1 0.004844961
## 1859         1 0.004844961
## 1863         1 0.004844961
## 1872         1 0.004844961
## 1874         2 0.009689922
## 1875         1 0.004844961
## 1879         1 0.004844961
## 1880         1 0.004844961
## 1882         2 0.009689922
## 1888         1 0.004844961
## 1889         1 0.004844961
## 1894         1 0.004844961
## 1899         1 0.004844961
## 1903         1 0.004844961
## 1906         2 0.009689922
## 1907         1 0.004844961
## 1909         1 0.004844961
## 1911         1 0.004844961
## 1919         2 0.009689922
## 1920         2 0.009689922
## 1922         2 0.009689922
## 1923         2 0.009689922
## 1924         1 0.004844961
## 1926         1 0.004844961
## 1929         1 0.004844961
## 1939         1 0.004844961
## 1944         1 0.004844961
## 1946         1 0.004844961
## 1949         1 0.004844961
## 1950         1 0.004844961
## 1953         1 0.004844961
## 1955         1 0.004844961
## 1957         1 0.004844961
## 1967         1 0.004844961
## 1972         1 0.004844961
## 1979         1 0.004844961
## 1985         1 0.004844961
## 1986         1 0.004844961
## 1989         1 0.004844961
## 1997         1 0.004844961
## 2003         1 0.004844961
## 2007         1 0.004844961
## 2009         2 0.009689922
## 2017         1 0.004844961
## 2019         1 0.004844961
## 2023         1 0.004844961
## 2028         1 0.004844961
## 2036         1 0.004844961
## 2038         1 0.004844961
## 2040         1 0.004844961
## 2041         1 0.004844961
## 2043         1 0.004844961
## 2051         1 0.004844961
## 2060         2 0.009689922
## 2080         1 0.004844961
## 2081         2 0.009689922
## 2082         1 0.004844961
## 2086         2 0.009689922
## 2094         1 0.004844961
## 2095         1 0.004844961
## 2100         1 0.004844961
## 2106         1 0.004844961
## 2116         1 0.004844961
## 2117         1 0.004844961
## 2118         1 0.004844961
## 2119         1 0.004844961
## 2125         1 0.004844961
## 2127         2 0.009689922
## 2138         1 0.004844961
## 2140         1 0.004844961
## 2144         1 0.004844961
## 2147         1 0.004844961
## 2152         2 0.009689922
## 2156         2 0.009689922
## 2157         1 0.004844961
## 2159         1 0.004844961
## 2168         1 0.004844961
## 2169         1 0.004844961
## 2173         1 0.004844961
## 2180         1 0.004844961
## 2194         1 0.004844961
## 2199         1 0.004844961
## 2200         1 0.004844961
## 2206         1 0.004844961
## 2207         1 0.004844961
## 2209         1 0.004844961
## 2221         1 0.004844961
## 2225         1 0.004844961
## 2230         1 0.004844961
## 2232         1 0.004844961
## 2245         1 0.004844961
## 2250         1 0.004844961
## 2251         1 0.004844961
## 2267         2 0.009689922
## 2270         1 0.004844961
## 2274         1 0.004844961
## 2285         1 0.004844961
## 2289         1 0.004844961
## 2299         1 0.004844961
## 2311         1 0.004844961
## 2312         1 0.004844961
## 2320         1 0.004844961
## 2323         1 0.004844961
## 2324         1 0.004844961
## 2329         1 0.004844961
## 2333         1 0.004844961
## 2335         1 0.004844961
## 2338         1 0.004844961
## 2342         1 0.004844961
## 2350         1 0.004844961
## 2357         1 0.004844961
## 2358         2 0.009689922
## 2359         2 0.009689922
## 2374         1 0.004844961
## 2375         1 0.004844961
## 2387         1 0.004844961
## 2392         1 0.004844961
## 2397         1 0.004844961
## 2406         1 0.004844961
## 2407         1 0.004844961
## 2410         1 0.004844961
## 2412         1 0.004844961
## 2418         1 0.004844961
## 2419         1 0.004844961
## 2424         1 0.004844961
## 2426         1 0.004844961
## 2428         1 0.004844961
## 2435         1 0.004844961
## 2437         1 0.004844961
## 2440         1 0.004844961
## 2441         1 0.004844961
## 2447         1 0.004844961
## 2452         1 0.004844961
## 2463         1 0.004844961
## 2473         1 0.004844961
## 2492         1 0.004844961
## 2497         1 0.004844961
## 2515         1 0.004844961
## 2523         1 0.004844961
## 2528         1 0.004844961
## 2533         1 0.004844961
## 2538         1 0.004844961
## 2552         2 0.009689922
## 2553         1 0.004844961
## 2565         1 0.004844961
## 2579         1 0.004844961
## 2606         1 0.004844961
## 2612         1 0.004844961
## 2615         1 0.004844961
## 2651         1 0.004844961
## 2654         1 0.004844961
## 2660         1 0.004844961
## 2666         1 0.004844961
## 2676         1 0.004844961
## 2683         1 0.004844961
## 2688         1 0.004844961
## 2707         1 0.004844961
## 2714         1 0.004844961
## 2716         1 0.004844961
## 2718         1 0.004844961
## 2723         1 0.004844961
## 2731         1 0.004844961
## 2742         1 0.004844961
## 2753         1 0.004844961
## 2769         1 0.004844961
## 2777         1 0.004844961
## 2789         1 0.004844961
## 2803         1 0.004844961
## 2812         1 0.004844961
## 2826         1 0.004844961
## 2829         1 0.004844961
## 2832         1 0.004844961
## 2838         1 0.004844961
## 2839         1 0.004844961
## 2847         1 0.004844961
## 2873         1 0.004844961
## 2885         1 0.004844961
## 2890         1 0.004844961
## 2895         1 0.004844961
## 2902         1 0.004844961
## 2905         1 0.004844961
## 2952         1 0.004844961
## 2962         1 0.004844961
## 2964         1 0.004844961
## 3028         1 0.004844961
## 3052         1 0.004844961
## 3061         1 0.004844961
## 3073         1 0.004844961
## 3086         1 0.004844961
## 3112         1 0.004844961
## 3176         1 0.004844961
## 3197         1 0.004844961
## 3232         1 0.004844961
## 3234         1 0.004844961
## 3252         1 0.004844961
## 3258         1 0.004844961
## 3262         1 0.004844961
## 3293         1 0.004844961
## 3302         1 0.004844961
## 3329         1 0.004844961
## 3361         1 0.004844961
## 3405         1 0.004844961
## 3441         1 0.004844961
## 3478         1 0.004844961
## 3510         1 0.004844961
## 3522         1 0.004844961
## 3589         1 0.004844961
## 3595         1 0.004844961
## 3671         1 0.004844961
## 3701         1 0.004844961
## 3744         1 0.004844961
## 3790         1 0.004844961
## 3832         1 0.004844961
## 3886         1 0.004844961
## 3931         1 0.004844961
## 3933         1 0.004844961
## 3958         1 0.004844961
## 4012         1 0.004844961
## 4072         1 0.004844961
## 4176         1 0.004844961
## 4204         1 0.004844961
## 4339         1 0.004844961
## 4372         1 0.004844961
## 4490         1 0.004844961
## 4616         1 0.004844961
## 4769         1 0.004844961
## 4855         1 0.004844961
## 4930         1 0.004844961
## 5050         1 0.004844961
## 5189         1 0.004844961
## 5358         1 0.004844961
## 6082         1 0.004844961
##Step 2:Measures of Central Tendency ----
### Calculate the mode ----
housing_chas_mode <- names(table(housing$households))[
  which(table(housing$households) == max(table(housing$households)))
]
print(housing_chas_mode)
## [1] "306"
##Step 3:Measure the distribution of the data for each variable ----
summary(housing)
##    longitude         latitude     housing_median_age  total_rooms   
##  Min.   :-124.3   Min.   :32.54   Min.   : 1.00      Min.   :    2  
##  1st Qu.:-121.8   1st Qu.:33.93   1st Qu.:18.00      1st Qu.: 1448  
##  Median :-118.5   Median :34.26   Median :29.00      Median : 2127  
##  Mean   :-119.6   Mean   :35.63   Mean   :28.64      Mean   : 2636  
##  3rd Qu.:-118.0   3rd Qu.:37.71   3rd Qu.:37.00      3rd Qu.: 3148  
##  Max.   :-114.3   Max.   :41.95   Max.   :52.00      Max.   :39320  
##                                                                     
##  total_bedrooms     population      households     median_income    
##  Min.   :   1.0   Min.   :    3   Min.   :   1.0   Min.   : 0.4999  
##  1st Qu.: 296.0   1st Qu.:  787   1st Qu.: 280.0   1st Qu.: 2.5634  
##  Median : 435.0   Median : 1166   Median : 409.0   Median : 3.5348  
##  Mean   : 537.9   Mean   : 1425   Mean   : 499.5   Mean   : 3.8707  
##  3rd Qu.: 647.0   3rd Qu.: 1725   3rd Qu.: 605.0   3rd Qu.: 4.7432  
##  Max.   :6445.0   Max.   :35682   Max.   :6082.0   Max.   :15.0001  
##  NA's   :207                                                        
##  ocean_proximity    median_house_value
##  Length:20640       Min.   : 14999    
##  Class :character   1st Qu.:119600    
##  Mode  :character   Median :179700    
##                     Mean   :206856    
##                     3rd Qu.:264725    
##                     Max.   :500001    
## 
## Measures of Relationship ----
#Measure the covariance between variables ----
# Note that the covariance and the correlation are computed for numeric values
# only, not categorical values.
housing_cov <- cov(housing[, -9])
View(housing_cov)

## Measures of Distribution/Dispersion/Spread/Scatter/Variability ----

### Measure the distribution of the data for each variable ----
summary(housing)
##    longitude         latitude     housing_median_age  total_rooms   
##  Min.   :-124.3   Min.   :32.54   Min.   : 1.00      Min.   :    2  
##  1st Qu.:-121.8   1st Qu.:33.93   1st Qu.:18.00      1st Qu.: 1448  
##  Median :-118.5   Median :34.26   Median :29.00      Median : 2127  
##  Mean   :-119.6   Mean   :35.63   Mean   :28.64      Mean   : 2636  
##  3rd Qu.:-118.0   3rd Qu.:37.71   3rd Qu.:37.00      3rd Qu.: 3148  
##  Max.   :-114.3   Max.   :41.95   Max.   :52.00      Max.   :39320  
##                                                                     
##  total_bedrooms     population      households     median_income    
##  Min.   :   1.0   Min.   :    3   Min.   :   1.0   Min.   : 0.4999  
##  1st Qu.: 296.0   1st Qu.:  787   1st Qu.: 280.0   1st Qu.: 2.5634  
##  Median : 435.0   Median : 1166   Median : 409.0   Median : 3.5348  
##  Mean   : 537.9   Mean   : 1425   Mean   : 499.5   Mean   : 3.8707  
##  3rd Qu.: 647.0   3rd Qu.: 1725   3rd Qu.: 605.0   3rd Qu.: 4.7432  
##  Max.   :6445.0   Max.   :35682   Max.   :6082.0   Max.   :15.0001  
##  NA's   :207                                                        
##  ocean_proximity    median_house_value
##  Length:20640       Min.   : 14999    
##  Class :character   1st Qu.:119600    
##  Mode  :character   Median :179700    
##                     Mean   :206856    
##                     3rd Qu.:264725    
##                     Max.   :500001    
## 
###. Measure the standard deviation of each variable ----
# a string data type.

sapply(housing[, -9], sd)
##          longitude           latitude housing_median_age        total_rooms 
##       2.003532e+00       2.135952e+00       1.258556e+01       2.181615e+03 
##     total_bedrooms         population         households      median_income 
##                 NA       1.132462e+03       3.823298e+02       1.899822e+00 
## median_house_value 
##       1.153956e+05
###Measure the variance of each variable ----
sapply(housing[, -9], var)
##          longitude           latitude housing_median_age        total_rooms 
##       4.014139e+00       4.562293e+00       1.583963e+02       4.759445e+06 
##     total_bedrooms         population         households      median_income 
##                 NA       1.282470e+06       1.461760e+05       3.609323e+00 
## median_house_value 
##       1.331615e+10
## Measures of Relationship ----

###Measure the covariance between variables ----
# Note that the covariance and the correlation are computed for numeric values
# only, not categorical values.
str(housing)
## spc_tbl_ [20,640 × 10] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ longitude         : num [1:20640] -122 -122 -122 -122 -122 ...
##  $ latitude          : num [1:20640] 37.9 37.9 37.9 37.9 37.9 ...
##  $ housing_median_age: num [1:20640] 41 21 52 52 52 52 52 52 42 52 ...
##  $ total_rooms       : num [1:20640] 880 7099 1467 1274 1627 ...
##  $ total_bedrooms    : num [1:20640] 129 1106 190 235 280 ...
##  $ population        : num [1:20640] 322 2401 496 558 565 ...
##  $ households        : num [1:20640] 126 1138 177 219 259 ...
##  $ median_income     : num [1:20640] 8.33 8.3 7.26 5.64 3.85 ...
##  $ ocean_proximity   : chr [1:20640] "NEAR BAY" "NEAR BAY" "NEAR BAY" "NEAR BAY" ...
##  $ median_house_value: num [1:20640] 452600 358500 352100 341300 342200 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   longitude = col_double(),
##   ..   latitude = col_double(),
##   ..   housing_median_age = col_double(),
##   ..   total_rooms = col_double(),
##   ..   total_bedrooms = col_double(),
##   ..   population = col_double(),
##   ..   households = col_double(),
##   ..   median_income = col_double(),
##   ..   ocean_proximity = col_character(),
##   ..   median_house_value = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>
housing_cov <- cov(housing[, -9])
View(housing_cov)




###Issue 2. Inferential Statistics
## STEP 16. Perform ANOVA on the “California Housing” dataset ----

# Dependent variable:    median_house_value
# Independent variables: median_income, households,total_rooms

##A One-way ANOVA
housing_one_way_anova <- aov(median_house_value ~ total_rooms, data = housing)
summary(housing_one_way_anova)
##                Df    Sum Sq   Mean Sq F value Pr(>F)    
## total_rooms     1 4.946e+12 4.946e+12   378.2 <2e-16 ***
## Residuals   20638 2.699e+14 1.308e+10                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##A two-way ANOVA
# can then be used to confirm this. Execute the following for a two-way ANOVA
# (two independent variables):

housing_additive_two_way_anova <- aov(median_house_value ~ total_rooms + median_income, # nolint
                                           data = housing)
summary(housing_additive_two_way_anova)
##                  Df    Sum Sq   Mean Sq F value Pr(>F)    
## total_rooms       1 4.946e+12 4.946e+12   705.4 <2e-16 ***
## median_income     1 1.252e+14 1.252e+14 17850.7 <2e-16 ***
## Residuals     20637 1.447e+14 7.012e+09                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
housing_interactive_two_way_anova <- aov(median_house_value ~ total_rooms * median_income, # nolint
                                              data = housing)
summary(housing_interactive_two_way_anova)
##                              Df    Sum Sq   Mean Sq  F value   Pr(>F)    
## total_rooms                   1 4.946e+12 4.946e+12   705.87  < 2e-16 ***
## median_income                 1 1.252e+14 1.252e+14 17863.70  < 2e-16 ***
## total_rooms:median_income     1 1.126e+11 1.126e+11    16.07 6.12e-05 ***
## Residuals                 20636 1.446e+14 7.007e+09                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
###Issue 3. BAsic Visualization
### Univariate Plots
.libPaths()
## [1] "C:/Users/Joy/R-4.3.1/library"
lapply(.libPaths(), list.files)
## [[1]]
##   [1] "abind"           "adabag"          "Amelia"          "arules"         
##   [5] "arulesViz"       "askpass"         "av"              "backports"      
##   [9] "base"            "base64enc"       "BayesFactor"     "bit"            
##  [13] "bit64"           "blob"            "boot"            "brew"           
##  [17] "brio"            "broom"           "bslib"           "C50"            
##  [21] "ca"              "cachem"          "Cairo"           "callr"          
##  [25] "car"             "carData"         "caret"           "caretEnsemble"  
##  [29] "cellranger"      "circlize"        "class"           "classInt"       
##  [33] "cli"             "clipr"           "clock"           "cluster"        
##  [37] "coda"            "codetools"       "collections"     "colorspace"     
##  [41] "colourpicker"    "combinat"        "commonmark"      "compiler"       
##  [45] "conflicted"      "ConsRank"        "contfrac"        "corrplot"       
##  [49] "covr"            "cowplot"         "cpp11"           "crayon"         
##  [53] "crosstalk"       "Cubist"          "curl"            "cyclocomp"      
##  [57] "data.table"      "datasets"        "DBI"             "dbplyr"         
##  [61] "dendextend"      "desc"            "deSolve"         "diagram"        
##  [65] "diffobj"         "digest"          "doParallel"      "dplyr"          
##  [69] "DT"              "dtplyr"          "e1071"           "ellipse"        
##  [73] "ellipsis"        "elliptic"        "emmeans"         "estimability"   
##  [77] "evaluate"        "factoextra"      "FactoMineR"      "fansi"          
##  [81] "farver"          "fastICA"         "fastmap"         "feather"        
##  [85] "flashClust"      "fontawesome"     "forcats"         "foreach"        
##  [89] "foreign"         "formatR"         "formattable"     "Formula"        
##  [93] "fs"              "future"          "future.apply"    "gapminder"      
##  [97] "gargle"          "gclus"           "generics"        "ggcorrplot"     
## [101] "ggforce"         "ggplot2"         "ggpubr"          "ggraph"         
## [105] "ggrepel"         "ggsci"           "ggsignif"        "gifski"         
## [109] "glmnet"          "GlobalOptions"   "globals"         "glue"           
## [113] "googledrive"     "googlesheets4"   "gower"           "graphics"       
## [117] "graphlayouts"    "grDevices"       "grid"            "gridExtra"      
## [121] "gtable"          "gtools"          "hardhat"         "haven"          
## [125] "highr"           "hms"             "htmltools"       "htmlwidgets"    
## [129] "httpuv"          "httr"            "hunspell"        "hypergeo"       
## [133] "ids"             "igraph"          "inum"            "ipred"          
## [137] "IRdisplay"       "isoband"         "iterators"       "janeaustenr"    
## [141] "jomo"            "jpeg"            "jquerylib"       "jsonlite"       
## [145] "kableExtra"      "kernlab"         "KernSmooth"      "klaR"           
## [149] "knitr"           "labeling"        "labelled"        "languageserver" 
## [153] "later"           "lattice"         "lava"            "lazyeval"       
## [157] "leaps"           "libcoin"         "LiblineaR"       "lifecycle"      
## [161] "lintr"           "listenv"         "lme4"            "lmtest"         
## [165] "lubridate"       "magick"          "magrittr"        "markdown"       
## [169] "MASS"            "Matrix"          "MatrixModels"    "memery"         
## [173] "memoise"         "methods"         "mgcv"            "mice"           
## [177] "mime"            "miniUI"          "minqa"           "mitml"          
## [181] "mlbench"         "mockr"           "ModelMetrics"    "modelr"         
## [185] "multcompView"    "munsell"         "mvtnorm"         "naivebayes"     
## [189] "naniar"          "NHANES"          "nlme"            "nloptr"         
## [193] "nnet"            "norm"            "numDeriv"        "openssl"        
## [197] "ordinal"         "packrat"         "pan"             "parallel"       
## [201] "parallelly"      "partykit"        "pbapply"         "pbkrtest"       
## [205] "pdftools"        "permute"         "pillar"          "pkgbuild"       
## [209] "pkgconfig"       "pkgload"         "plotly"          "plumber"        
## [213] "plyr"            "png"             "polyclip"        "polynom"        
## [217] "praise"          "prettyunits"     "pROC"            "processx"       
## [221] "prodlim"         "progress"        "progressr"       "promises"       
## [225] "proxy"           "ps"              "purrr"           "qap"            
## [229] "qpdf"            "quantreg"        "questionr"       "R.cache"        
## [233] "R.methodsS3"     "R.oo"            "R.utils"         "R6"             
## [237] "radarchart"      "ragg"            "randomForest"    "RANN"           
## [241] "rappdirs"        "RColorBrewer"    "Rcpp"            "RcppArmadillo"  
## [245] "RcppEigen"       "readr"           "readxl"          "recipes"        
## [249] "registry"        "rematch"         "rematch2"        "remotes"        
## [253] "renv"            "repr"            "reprex"          "reshape2"       
## [257] "rex"             "rgl"             "rlang"           "rlist"          
## [261] "rmarkdown"       "roxygen2"        "rpart"           "rprojroot"      
## [265] "RRF"             "rsconnect"       "rstatix"         "rstudioapi"     
## [269] "rsvg"            "rvest"           "sass"            "scales"         
## [273] "scatterplot3d"   "selectr"         "seriation"       "shape"          
## [277] "shiny"           "shinyBS"         "shinycssloaders" "shinyjs"        
## [281] "showtext"        "showtextdb"      "SnowballC"       "sodium"         
## [285] "sourcetools"     "SparseM"         "spatial"         "spelling"       
## [289] "splines"         "SQUAREM"         "stats"           "stats4"         
## [293] "stringi"         "stringr"         "styler"          "survival"       
## [297] "svglite"         "swagger"         "sys"             "sysfonts"       
## [301] "systemfonts"     "tcltk"           "tesseract"       "testthat"       
## [305] "textdata"        "textshaping"     "tibble"          "tidygraph"      
## [309] "tidyr"           "tidyselect"      "tidytext"        "tidyverse"      
## [313] "timechange"      "timeDate"        "tinytex"         "tokenizers"     
## [317] "tools"           "translations"    "TSP"             "tweenr"         
## [321] "tzdb"            "ucminf"          "UpSetR"          "utf8"           
## [325] "utils"           "uuid"            "vcd"             "vctrs"          
## [329] "vegan"           "viridis"         "viridisLite"     "visdat"         
## [333] "visNetwork"      "vroom"           "waldo"           "webp"           
## [337] "webshot"         "webutils"        "widyr"           "withr"          
## [341] "wordcloud2"      "xfun"            "XML"             "xml2"           
## [345] "xmlparsedata"    "xtable"          "yaml"            "yarrr"          
## [349] "zoo"
if (!is.element("languageserver", installed.packages()[, 1])) {
  install.packages("languageserver", dependencies = TRUE)
}
require("languageserver")
## Loading required package: languageserver
# STEP 1. Install and Load the Required Packages ----
# The following packages can be installed and loaded before proceeding to the
# subsequent steps.

## dplyr - For data manipulation ----
if (!is.element("dplyr", installed.packages()[, 1])) {
  install.packages("dplyr", dependencies = TRUE)
}
require("dplyr")
## Loading required package: dplyr
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## ggplot2 - For data visualizations using the Grammar for Graphics package ----
if (!is.element("ggplot2", installed.packages()[, 1])) {
  install.packages("ggplot2", dependencies = TRUE)
}
require("ggplot2")
## Loading required package: ggplot2
## ggrepel - Additional options for the Grammar for Graphics package ----
if (!is.element("ggrepel", installed.packages()[, 1])) {
  install.packages("ggrepel", dependencies = TRUE)
}
require("ggrepel")
## Loading required package: ggrepel
## ggraph - Additional options for the Grammar for Graphics package ----
if (!is.element("ggraph", installed.packages()[, 1])) {
  install.packages("ggraph", dependencies = TRUE)
}
require("ggraph")
## Loading required package: ggraph
## tidytext - For text mining ----
if (!is.element("tidytext", installed.packages()[, 1])) {
  install.packages("tidytext", dependencies = TRUE)
}
require("tidytext")
## Loading required package: tidytext
## tidyr - To tidy messy data ----
if (!is.element("tidyr", installed.packages()[, 1])) {
  install.packages("tidyr", dependencies = TRUE)
}
require("tidyr")
## Loading required package: tidyr
## widyr - To widen, process, and re-tidy a dataset ----
if (!is.element("widyr", installed.packages()[, 1])) {
  install.packages("widyr", dependencies = TRUE)
}
require("widyr")
## Loading required package: widyr
## gridExtra - to arrange multiple grid-based plots on a page ----
if (!is.element("gridExtra", installed.packages()[, 1])) {
  install.packages("gridExtra", dependencies = TRUE)
}
require("gridExtra")
## Loading required package: gridExtra
## 
## Attaching package: 'gridExtra'
## 
## The following object is masked from 'package:dplyr':
## 
##     combine
## knitr - for dynamic report generation ----
if (!is.element("knitr", installed.packages()[, 1])) {
  install.packages("knitr", dependencies = TRUE)
}
require("knitr")
## Loading required package: knitr
## kableExtra - for nicely formatted output tables ----
if (!is.element("kableExtra", installed.packages()[, 1])) {
  install.packages("kableExtra", dependencies = TRUE)
}
require("kableExtra")
## Loading required package: kableExtra
## 
## Attaching package: 'kableExtra'
## 
## The following object is masked from 'package:dplyr':
## 
##     group_rows
## formattable -  To create a formattable object ----
# A formattable object is an object to which a formatting function and related
# attributes are attached.
if (!is.element("formattable", installed.packages()[, 1])) {
  install.packages("formattable", dependencies = TRUE)
}
require("formattable")
## Loading required package: formattable
## circlize - To create a cord diagram or visualization ----
# by Gu et al. (2014)
if (!is.element("circlize", installed.packages()[, 1])) {
  install.packages("circlize", dependencies = TRUE)
}
require("circlize")
## Loading required package: circlize
## ========================================
## circlize version 0.4.15
## CRAN page: https://cran.r-project.org/package=circlize
## Github page: https://github.com/jokergoo/circlize
## Documentation: https://jokergoo.github.io/circlize_book/book/
## 
## If you use it in published research, please cite:
## Gu, Z. circlize implements and enhances circular visualization
##   in R. Bioinformatics 2014.
## 
## This message can be suppressed by:
##   suppressPackageStartupMessages(library(circlize))
## ========================================
if (!is.element("memery", installed.packages()[, 1])) {
  install.packages("memery", dependencies = TRUE)
}
require("memery")
## Loading required package: memery
## Loading required package: showtext
## Loading required package: sysfonts
## Loading required package: showtextdb
## magick - For image processing in R ----
if (!is.element("magick", installed.packages()[, 1])) {
  install.packages("magick", dependencies = TRUE)
}
require("magick")
## Loading required package: magick
## Linking to ImageMagick 6.9.12.96
## Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
## Disabled features: fontconfig, x11
## yarrr - To create a pirate plot ----
if (!is.element("yarrr", installed.packages()[, 1])) {
  install.packages("yarrr", dependencies = TRUE)
}
require("yarrr")
## Loading required package: yarrr
## Loading required package: jpeg
## Loading required package: BayesFactor
## Loading required package: coda
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## 
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
## 
## ************
## Welcome to BayesFactor 0.9.12-4.5. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
## 
## Type BFManual() to open the manual.
## ************
## yarrr v0.1.5. Citation info at citation('yarrr'). Package guide at yarrr.guide()
## Email me at Nathaniel.D.Phillips.is@gmail.com
## 
## Attaching package: 'yarrr'
## 
## The following object is masked from 'package:ggplot2':
## 
##     diamonds
## radarchart - To create interactive radar charts using ChartJS ----
if (!is.element("radarchart", installed.packages()[, 1])) {
  install.packages("radarchart", dependencies = TRUE)
}
require("radarchart")
## Loading required package: radarchart
## igraph - To create ngram network diagrams ----
if (!is.element("igraph", installed.packages()[, 1])) {
  install.packages("igraph", dependencies = TRUE)
}
require("igraph")
## Loading required package: igraph
## 
## Attaching package: 'igraph'
## 
## The following object is masked from 'package:BayesFactor':
## 
##     compare
## 
## The following object is masked from 'package:circlize':
## 
##     degree
## 
## The following object is masked from 'package:formattable':
## 
##     normalize
## 
## The following object is masked from 'package:tidyr':
## 
##     crossing
## 
## The following objects are masked from 'package:dplyr':
## 
##     as_data_frame, groups, union
## 
## The following objects are masked from 'package:stats':
## 
##     decompose, spectrum
## 
## The following object is masked from 'package:base':
## 
##     union
## wordcloud2 - For creating wordcloud by using 'wordcloud2.JS ----
if (!is.element("wordcloud2", installed.packages()[, 1])) {
  install.packages("wordcloud2", dependencies = TRUE)
}
require("wordcloud2")
## Loading required package: wordcloud2
## textdata - Download sentiment lexicons and labeled text data sets ----
if (!is.element("textdata", installed.packages()[, 1])) {
  install.packages("textdata", dependencies = TRUE)
}
require("textdata")
## Loading required package: textdata
## readr - Load datasets from CSV files ----
if (!is.element("readr", installed.packages()[, 1])) {
  install.packages("readr", dependencies = TRUE)
}
require("readr")

## stringr - For processing characters in a string ----
if (!is.element("stringr", installed.packages()[, 1])) {
  install.packages("stringr", dependencies = TRUE,
                   repos = "https://cloud.r-project.org")
}
require("stringr")
## Loading required package: stringr
# STEP 2. Load the Dataset
library(readr)
housing <- read_csv("data/housing.csv", col_types = cols(longitude = col_double(), 
                                                         latitude = col_double(), housing_median_age = col_number(), 
                                                         total_rooms = col_number(), total_bedrooms = col_number(), 
                                                         population = col_number(), households = col_number(), 
                                                         median_income = col_number(), ocean_proximity = col_character(), 
                                                         median_house_value = col_number()))
View(housing)
###Create Univariate plots
#1. Create a histogram
# Create a histogram using ggplot2
library(ggplot2)

# Customize the plot
ggplot(housing, aes(x = median_income)) +
  geom_histogram(binwidth = 1, fill = "#536CB5", color = "#304FAF") +
  labs(title = "Histogram of Median Income",
       x = "Median Income",
       y = "Frequency") +
  theme_minimal()

 ##2. Create a bar plot using ggplot2
library(ggplot2)

# Customize the plot
ggplot(housing, aes(x = ocean_proximity)) +
  geom_bar(fill = "#536CB5", color = "#304FAF") +
  labs(title = "Bar Plot of Ocean Proximity",
       x = "Ocean Proximity",
       y = "Count") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  # Rotate x-axis labels for better readability

##3.Create a box plot using ggplot2
library(ggplot2)

# Customize the plot
ggplot(housing, aes(y = median_house_value)) +
  geom_boxplot(fill = "#536CB5", color = "#304FAF") +
  labs(title = "Box Plot of Median House Value",
       y = "Median House Value") +
  theme_minimal()

##4. Create a density plot using ggplot2
library(ggplot2)

# Customize the plot
ggplot(housing, aes(x = median_house_value)) +
  geom_density(fill = "#536CB5", color = "#304FAF") +
  labs(title = "Density Plot of Median House Value",
       x = "Median House Value") +
  theme_minimal()

########################################################################
#####Multivariate Plot
# Assuming 'median_income' and 'median_house_value' are numeric variables in your dataset
# Replace them with the actual variable names if different

##1.Create a scatter plot using ggplot2
library(ggplot2)

# Customize the plot
ggplot(housing, aes(x = median_income, y = median_house_value)) +
  geom_point(color = "#536CB5") +
  labs(title = "Scatter Plot of Median Income vs. Median House Value",
       x = "Median Income",
       y = "Median House Value") +
  theme_minimal()

##2. Create a pair plot using ggplot2
library(ggplot2)

# Customize the plot
ggplot(housing, aes(x = median_income, y = ..density..)) +
  geom_density() +
  facet_grid(. ~ housing_median_age) +
  labs(title = "Pair Plot of Numeric Variables",
       x = "Median Income") +
  theme_minimal()
## Warning: The dot-dot notation (`..density..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(density)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

# Load necessary libraries
library(ggplot2)
library(tidyr)
library(dplyr)  # Add this line to explicitly load the dplyr package

# Select relevant numeric variables
numeric_data <- housing %>%
  select(median_income, housing_median_age, total_rooms, total_bedrooms, population, median_house_value)

# Rest of the code remains the same...

# Compute the correlation matrix
cor_matrix <- cor(numeric_data)

# Create a heatmap using ggplot

# Load necessary libraries
library(ggplot2)
library(tidyr)

# Select relevant numeric variables
numeric_data <- housing %>%
  select(median_income, housing_median_age, total_rooms, total_bedrooms, population, median_house_value)

# Compute the correlation matrix
cor_matrix <- cor(numeric_data)

# Convert the correlation matrix to a data frame
cor_data <- as.data.frame(as.table(cor_matrix))

##3.Create a heatmap using ggplot2
ggplot(data = cor_data, aes(Var1, Var2, fill = Freq)) +
  geom_tile() +
  scale_fill_gradient(low = "#888A8E", high = "#536CB5") +
  labs(title = "Correlation Heatmap",
       x = "Variables",
       y = "Variables") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))