For this week’s Data Dive, I am continuing to use the Seoul Bike Sharing Demand dataset. The dataset contains hourly bike rental information from Seoul along with weather, seasonal, holiday, and operational information.
This week I focused on why documentation is important when interpreting a dataset. Some variables look simple at first, but their meaning is not completely clear without reading the documentation.
library(tidyverse)
bike <- read.csv("SeoulBikeData.csv", check.names = FALSE)
dim(bike)
## [1] 8760 14
names(bike)
## [1] "Date" "Rented Bike Count"
## [3] "Hour" "Temperature(\xb0C)"
## [5] "Humidity(%)" "Wind speed (m/s)"
## [7] "Visibility (10m)" "Dew point temperature(\xb0C)"
## [9] "Solar Radiation (MJ/m2)" "Rainfall(mm)"
## [11] "Snowfall (cm)" "Seasons"
## [13] "Holiday" "Functioning Day"
head(bike)
## Date Rented Bike Count Hour Temperature(\xb0C) Humidity(%)
## 1 01/12/2017 254 0 -5.2 37
## 2 01/12/2017 204 1 -5.5 38
## 3 01/12/2017 173 2 -6.0 39
## 4 01/12/2017 107 3 -6.2 40
## 5 01/12/2017 78 4 -6.0 36
## 6 01/12/2017 100 5 -6.4 37
## Wind speed (m/s) Visibility (10m) Dew point temperature(\xb0C)
## 1 2.2 2000 -17.6
## 2 0.8 2000 -17.6
## 3 1.0 2000 -17.7
## 4 0.9 2000 -17.6
## 5 2.3 2000 -18.6
## 6 1.5 2000 -18.7
## Solar Radiation (MJ/m2) Rainfall(mm) Snowfall (cm) Seasons Holiday
## 1 0 0 0 Winter No Holiday
## 2 0 0 0 Winter No Holiday
## 3 0 0 0 Winter No Holiday
## 4 0 0 0 Winter No Holiday
## 5 0 0 0 Winter No Holiday
## 6 0 0 0 Winter No Holiday
## Functioning Day
## 1 Yes
## 2 Yes
## 3 Yes
## 4 Yes
## 5 Yes
## 6 Yes
The dataset contains 8,760 rows and 14 columns. Looking at the column names helped me identify variables whose meanings could easily be misunderstood without documentation.
One column that was not immediately clear to me was
Visibility (10m). When I first saw values such as 2000, I
could tell that they represented visibility, but the scale was not
obvious just from looking at the values.
The documentation identifies this variable as visibility measured using a 10-meter unit. The unit included in the column name is therefore important when interpreting the values.
I think the data was encoded numerically because visibility is a continuous measurement and numerical values make it easier to compare observations and use the variable in statistical analysis or modeling.
If I ignored the documentation or the unit, I could describe the visibility values incorrectly. This could lead to incorrect interpretations when comparing visibility with bike rentals.
summary(bike$`Visibility (10m)`)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 27 940 1698 1437 2000 2000
Another column that required documentation was
Functioning Day. From the name alone, it was not
immediately obvious what was functioning.
table(bike$`Functioning Day`)
##
## No Yes
## 295 8465
The documentation explains that this variable identifies whether the
bike rental system was functioning. The dataset represents this using
the categories Yes and No.
I think this was encoded as a categorical variable because there are
two operational states. Using Yes and No makes
it easy to separate functioning and non-functioning periods.
Without understanding this column, I might have treated observations with zero rentals as periods of zero customer demand. However, some zero values occur because the system was not functioning. That is very different from a functioning system where nobody rented a bike.
An issue that is still unclear to me is the reason why certain observations are classified as non-functioning days.
The documentation tells me what Functioning Day
represents, but it does not explain why the bike rental system was not
functioning during those observations.
For example, I do not know whether the system was unavailable because of maintenance, an operational problem, a planned closure, weather conditions, or another reason.
This is important because a non-functioning system automatically prevents rentals. If I treated these observations as normal periods of low demand, I could incorrectly conclude that people simply did not want to rent bikes during those periods.
table(bike$`Functioning Day`, bike$`Rented Bike Count`)
##
## 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## No 295 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 0 3 2 5 3 3 4 7 12 7 7 8 6 6 4 6 14 11
##
## 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 9 10 6 14 10 9 9 6 8 10 10 12 8 15 9 13 8 8
##
## 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 8 14 16 10 10 12 10 8 12 11 15 8 11 12 8 11 6 10
##
## 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 12 11 6 13 13 12 10 17 11 6 14 7 12 9 7 9 17 12
##
## 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 7 7 14 6 8 11 13 13 12 12 6 11 6 6 4 6 7 8
##
## 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 10 12 8 13 11 10 7 11 8 4 11 18 7 12 9 15 10
##
## 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 10 14 7 9 7 6 11 10 11 7 9 6 6 19 14 10 8 10
##
## 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 9 11 9 7 4 11 12 7 7 6 15 6 9 13 10 12 8 12
##
## 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 14 12 9 11 15 11 12 15 6 9 9 10 10 7 10 11 11 14
##
## 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 8 13 18 12 11 13 16 17 11 11 12 15 10 5 10 17 6 6
##
## 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 11 11 13 16 11 10 12 14 18 14 10 7 14 5 13 13 10 8
##
## 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 8 8 4 9 8 8 6 12 10 9 8 9 12 14 13 16 11 12
##
## 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 8 13 8 6 10 13 19 6 16 11 14 12 5 10 10 10 10 9
##
## 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 7 8 10 7 14 13 12 4 14 10 5 10 11 11 9 9 8 11
##
## 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 13 9 8 7 5 16 10 10 8 19 9 8 11 12 12 7 8 9
##
## 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 8 8 15 6 7 7 13 13 8 4 9 10 9 7 12 10 4 8
##
## 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 11 8 7 9 6 10 7 9 7 5 12 4 9 7 7 11 8 11
##
## 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 10 12 12 6 7 4 7 7 10 7 4 6 9 7 9 5 6
##
## 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 8 9 9 8 7 5 5 10 7 10 9 5 7 4 6 8 7 9
##
## 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 8 5 8 7 4 2 11 4 5 10 8 10 9 10 3 4 3 4
##
## 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 6 7 5 3 6 7 4 4 4 7 4 9 8 4 9 10 4 5
##
## 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 6 3 14 7 3 8 8 3 9 7 3 7 2 6 7 4 6 6
##
## 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 8 5 2 4 7 11 10 5 9 5 4 2 6 6 4 6 2 3
##
## 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 7 5 4 6 3 5 9 6 4 4 9 6 6 4 4 6 2
##
## 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 4 4 10 4 5 1 7 3 1 15 5 1 2 5 3 3 5
##
## 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 2 7 4 6 8 2 4 2 8 6 4 3 3 2 8 5 5
##
## 469 470 471 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 6 2 3 3 8 2 5 3 1 1 5 4 4 5 4 7 4
##
## 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 5 4 5 5 2 4 1 3 3 4 6 2 2 4 5 6 3
##
## 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 524
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 6 2 6 1 3 4 6 3 3 3 5 6 1 6 5 7 5
##
## 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 5 4 1 5 4 8 4 7 5 5 2 7 1 1 4 1 5
##
## 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 3 5 4 4 1 1 4 1 6 3 8 11 6 3 4 3 4
##
## 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 578 579
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 7 7 1 5 3 4 8 6 3 5 7 3 4 5 4 7 6
##
## 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 5 4 8 6 5 7 5 5 9 2 5 7 2 5 1 3 2
##
## 598 600 602 603 604 605 606 608 609 610 611 612 613 614 615 616 617 618
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 13 3 5 3 4 5 4 4 5 5 6 2 7 2 7 1 3
##
## 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 6 5 3 4 7 5 5 4 2 4 4 3 4 6 1 2 4 5
##
## 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 4 4 3 2 4 5 11 6 6 5 4 3 2 4 7 5 2
##
## 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 9 4 5 5 5 2 3 6 3 5 4 6 1 6 2 7 6 7
##
## 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 2 6 10 4 5 4 6 4 5 7 3 3 2 3 6 2 5
##
## 691 692 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 4 5 5 5 6 4 8 6 3 3 4 1 4 4 4 4 3
##
## 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 5 4 4 4 5 8 4 7 9 5 5 2 3 5 4 5 5
##
## 728 729 730 731 732 733 734 735 736 737 739 740 741 742 743 744 745 746
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 3 1 4 3 6 1 6 2 3 5 7 5 5 1 2 4 3
##
## 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 2 1 2 3 8 2 6 2 2 4 4 5 4 5 4 7 8
##
## 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 6 4 7 5 5 6 4 1 4 5 7 5 4 4 2 3 6 5
##
## 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 6 8 4 4 3 4 3 4 8 1 6 5 5 3 7 4 3 1
##
## 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 5 1 3 3 2 5 2 7 2 2 5 2 3 3 1 10 4
##
## 820 821 822 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 1 5 2 4 3 5 4 5 2 3 5 1 4 4 1 6 2
##
## 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 6 1 2 7 2 3 2 5 7 6 4 4 2 3 5 2 4 1
##
## 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 1 2 4 7 1 5 4 2 5 3 1 3 3 4 1 1
##
## 875 876 877 878 880 881 882 883 884 885 886 887 888 889 890 891 892 893
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 3 5 3 6 4 2 6 2 2 5 1 1 2 3 3 3 1
##
## 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 2 2 4 2 2 6 4 3 1 3 6 4 3 3 4 2
##
## 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 7 3 4 4 6 2 2 4 6 3 7 5 1 7 6 1 5 4
##
## 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 5 3 4 7 3 4 4 6 4 4 6 4 5 7 3 4 1
##
## 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 3 1 1 2 3 2 2 4 4 1 7 4 3 4 6 1 4
##
## 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 5 4 4 3 8 6 4 4 4 2 3 2 3 3 3 10 7
##
## 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 3 6 4 4 3 2 5 5 6 4 4 5 5 1 3 2 4
##
## 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 6 4 5 4 3 2 1 3 3 2 3 5 4
##
## 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 3 2 5 4 3 1 4 4 7 4 4 2 4
##
## 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1044
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 6 3 5 3 3 1 4 3 8 3 6 2 3
##
## 1045 1046 1047 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 3 6 6 1 3 4 1 5 4 3 2 5 3
##
## 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 4 6 4 4 1 7 1 3 6 5 6 3 6
##
## 1074 1075 1076 1077 1078 1079 1080 1082 1083 1084 1085 1086 1087 1088
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 5 6 4 2 4 3 4 1 6 4 2 2 6 6
##
## 1089 1091 1092 1093 1094 1095 1096 1097 1099 1100 1101 1102 1103 1104
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 3 1 5 5 3 6 4 4 3 2 2 1
##
## 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 7 3 5 1 3 5 4 6 1 6 2 7 4
##
## 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 6 3 4 2 4 3 3 3 1 4 3 3 2 2
##
## 1133 1134 1135 1136 1137 1138 1139 1141 1142 1143 1144 1145 1146 1147
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 3 2 2 3 1 1 3 6 1 2 4 5 3
##
## 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1160 1161 1162
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 1 2 2 5 2 2 5 7 1 5 4 5 2
##
## 1163 1164 1165 1166 1167 1168 1169 1170 1171 1173 1174 1175 1176 1177
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 2 7 2 3 3 3 1 6 2 4 4 4 4
##
## 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 3 3 3 4 4 5 3 3 5 2 1 7
##
## 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 3 2 2 2 4 2 1 5 3 5 3 1 1
##
## 1206 1207 1208 1209 1210 1211 1212 1213 1215 1216 1217 1218 1219 1220
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 1 3 7 3 1 3 6 4 4 1 2 2 3
##
## 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 3 4 3 1 2 2 1 4 1 2 2 3 4
##
## 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1246 1247 1248 1249
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 1 2 3 3 3 4 2 2 1 3 4 2 6
##
## 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1263 1266
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 6 2 3 3 1 3 1 4 1 2 3 3 3
##
## 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 4 2 2 2 7 4 3 2 3 4 1 5
##
## 1281 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 5 4 1 2 3 4 5 3 5 3 3 2
##
## 1296 1297 1298 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 1 2 2 1 1 4 1 1 5 1 3 2 1
##
## 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 2 1 3 1 3 3 1 1 1 3 2 1
##
## 1325 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1340 1342 1343
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 1 2 4 1 2 2 1 1 2 2 1 2 1
##
## 1344 1346 1347 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 4 6 3 1 1 2 1 1 2 3 3 3 4 1
##
## 1360 1362 1363 1364 1365 1366 1367 1371 1372 1373 1374 1375 1377 1379
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 4 3 1 2 1 1 3 1 2 3 2 4 1
##
## 1380 1381 1382 1384 1385 1386 1387 1388 1389 1390 1391 1393 1394 1395
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 4 2 2 1 3 1 1 2 2 3 2 4 2
##
## 1396 1398 1399 1400 1401 1402 1404 1406 1407 1408 1409 1411 1412 1413
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 3 2 5 2 4 3 5 1 3 1 1 2
##
## 1414 1415 1416 1417 1418 1420 1421 1422 1423 1424 1425 1426 1427 1429
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 3 1 1 1 3 1 2 1 3 1 2 2
##
## 1430 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1444 1445
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 4 2 1 2 2 2 1 4 2 5 1 3
##
## 1446 1447 1448 1449 1450 1452 1455 1456 1457 1458 1459 1460 1461 1462
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 3 3 1 2 1 1 4 2 2 1 1 1 4
##
## 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1477
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 5 2 5 2 1 2 1 2 1 3 2 1 1
##
## 1478 1479 1480 1482 1483 1485 1486 1487 1488 1489 1490 1491 1492 1493
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 2 2 2 2 1 1 2 2 2 1 2 2 3
##
## 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1505 1507 1511 1512
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 3 1 2 1 1 2 3 5 2 2 3 4 1
##
## 1513 1514 1516 1517 1519 1521 1522 1523 1524 1525 1526 1527 1528 1529
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 1 3 3 2 1 1 1 2 2 1 3 2 3
##
## 1530 1531 1532 1533 1534 1535 1536 1537 1538 1540 1542 1543 1544 1546
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 2 1 1 2 3 1 1 2 1 2 2 1
##
## 1547 1548 1550 1551 1552 1553 1554 1556 1557 1558 1559 1560 1561 1562
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 5 5 2 1 2 6 2 2 1 1 1 1
##
## 1563 1565 1566 1567 1568 1569 1571 1573 1575 1577 1578 1579 1580 1581
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 2 1 2 2 3 2 1 3 3 4 2 1
##
## 1582 1583 1585 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 1 1 2 1 2 4 2 4 1 2 4 1
##
## 1599 1600 1601 1602 1603 1604 1605 1607 1608 1611 1612 1613 1614 1615
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 2 4 2 1 1 2 2 1 2 1 2
##
## 1616 1618 1620 1622 1624 1626 1628 1629 1630 1632 1634 1635 1636 1638
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 4 1 1 2 1 1 2 2 1 2 4 3 1
##
## 1639 1640 1641 1642 1644 1646 1647 1648 1649 1651 1652 1653 1654 1655
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 1 5 1 2 2 1 2 1 1 1 1 1 1
##
## 1656 1657 1659 1660 1662 1663 1664 1665 1666 1668 1669 1671 1672 1674
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 3 2 1 3 2 4 3 2 1 1 2 1 2
##
## 1675 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1688 1690 1692
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 3 1 1 1 1 1 1 3 3 1 2 1
##
## 1693 1695 1696 1697 1698 1699 1700 1702 1703 1704 1705 1706 1707 1708
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 1 2 1 1 1 3 1 2 1 1 3 2
##
## 1709 1710 1711 1712 1713 1714 1717 1719 1720 1721 1723 1726 1727 1728
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 1 2 2 2 3 3 2 1 2 1 2 1 1
##
## 1729 1730 1731 1732 1737 1738 1740 1741 1743 1744 1745 1747 1749 1751
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 3 3 3 2 1 1 1 1 2 1 2 1 2
##
## 1752 1753 1754 1759 1760 1761 1762 1763 1764 1767 1769 1772 1773 1775
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 1 2 1 1 1 1 1 2 1 1 2 1
##
## 1776 1777 1779 1780 1781 1782 1783 1785 1786 1787 1788 1789 1790 1791
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 2 1 1 2 3 1 1 1 1 2 1 1
##
## 1792 1796 1797 1798 1799 1801 1804 1805 1806 1807 1808 1811 1812 1813
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 2 2 1 2 2 1 1 2 1 3 1 1
##
## 1814 1815 1818 1819 1820 1821 1822 1823 1824 1826 1827 1828 1832 1833
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 1 1 2 3 1 1 1 2 1 1 1 1 1
##
## 1834 1835 1836 1837 1838 1839 1840 1841 1845 1846 1847 1848 1849 1850
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 1 2 2 3 2 1 1 1 2 2 1 1 1
##
## 1851 1853 1856 1857 1860 1861 1863 1865 1867 1868 1869 1870 1872 1875
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 3 1 3 2 1 1 2 3 1 2 3 3 1 2
##
## 1877 1878 1879 1881 1882 1883 1885 1886 1887 1888 1889 1890 1891 1892
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 3 1 3 2 2 2 2 1 2 1 2 4 2
##
## 1893 1896 1898 1899 1900 1902 1903 1904 1905 1906 1907 1909 1910 1911
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 2 2 3 2 1 4 1 1 1 1 1 1
##
## 1912 1915 1916 1917 1918 1920 1921 1922 1923 1924 1928 1929 1930 1931
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 2 1 2 2 1 1 1 2 1 2 2 1
##
## 1932 1933 1934 1935 1936 1937 1939 1940 1941 1942 1943 1944 1945 1946
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 4 4 1 3 3 3 1 1 2 3 2 1
##
## 1947 1948 1949 1950 1951 1955 1956 1958 1959 1961 1965 1968 1969 1970
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 1 1 1 2 2 2 2 1 2 2 1 1
##
## 1971 1972 1975 1976 1978 1979 1980 1983 1985 1986 1987 1990 1991 1993
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 1 2 1 4 1 1 2 2 2 3 2 2
##
## 1994 1995 1996 1997 1999 2000 2001 2002 2003 2005 2008 2011 2012 2013
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 5 3 1 3 4 1 1 1 1 2 1 2 1
##
## 2014 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2028 2029
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 2 3 2 3 2 1 1 1 1 1
##
## 2032 2033 2034 2035 2036 2039 2040 2041 2043 2044 2045 2046 2047 2048
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 2 1 1 1 1 1 2 2 1 1 1 1
##
## 2051 2055 2056 2057 2058 2059 2060 2063 2064 2065 2066 2068 2069 2070
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 3 1 1 1 3 1 1 1 2 1 2 4 4
##
## 2072 2074 2080 2081 2082 2084 2087 2088 2090 2091 2092 2094 2096 2097
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 1 1 2 1 1 1 1 1 1 3 1 1
##
## 2098 2099 2100 2101 2103 2104 2108 2111 2112 2113 2114 2115 2118 2122
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 2 2 2 1 1 1 2 1 3 3 1 3
##
## 2123 2127 2128 2129 2130 2131 2134 2135 2140 2142 2143 2145 2146 2147
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 3 1 2 1 1 2 1 3 1 1 2 2 1
##
## 2149 2150 2153 2154 2155 2159 2161 2162 2163 2164 2166 2167 2169 2170
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 2 2 1 1 1 2 2 1 2 3 1 1
##
## 2171 2173 2174 2175 2176 2177 2179 2182 2183 2186 2188 2189 2190 2191
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 1 1 3 1 1 1 1 1
##
## 2194 2198 2200 2201 2202 2207 2212 2213 2214 2215 2223 2224 2225 2227
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 3 1 2 1 1 1 2 1 1 1 1 1
##
## 2232 2234 2235 2236 2237 2238 2240 2241 2242 2245 2246 2248 2251 2252
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 1 4 1 1 2 1 2 1 1 2 1 1 1
##
## 2253 2254 2255 2256 2259 2260 2261 2262 2264 2266 2267 2268 2270 2272
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 2 2 1 1 1 1 1 1 1 2 3 4 1
##
## 2273 2274 2276 2278 2281 2282 2283 2286 2287 2288 2289 2290 2297 2300
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 3 2 2 2 1 1 1 1 3 2 1 1 2
##
## 2305 2307 2309 2310 2312 2313 2314 2317 2318 2320 2322 2326 2328 2329
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 2 2 1 1 2 1 1 1 1 2 3 2
##
## 2330 2331 2333 2334 2337 2338 2339 2346 2347 2348 2349 2351 2352 2353
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 3 2 2 1 1 2 2 1 1 1
##
## 2355 2357 2359 2362 2364 2365 2367 2368 2369 2370 2372 2375 2377 2378
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 2 1 1 1 2 3 2 1 1 2 1 1 2
##
## 2379 2383 2387 2391 2392 2397 2398 2400 2401 2402 2403 2404 2405 2410
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 1 1 2 1 1 3 2 1
##
## 2415 2416 2419 2422 2429 2430 2431 2432 2435 2436 2439 2440 2441 2443
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 2 1 1 1 1 1 1 1 1 1 1 1 1 1
##
## 2445 2450 2451 2454 2455 2456 2460 2468 2474 2475 2476 2479 2481 2487
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 2 1 2 1 1 2 2 1
##
## 2489 2491 2493 2495 2497 2499 2505 2508 2514 2515 2518 2519 2525 2528
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 2 1 2 1 2 1 1 1 1 1
##
## 2534 2556 2557 2558 2574 2577 2579 2594 2598 2602 2612 2613 2615 2618
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1
##
## 2628 2631 2632 2635 2636 2637 2640 2649 2650 2656 2661 2664 2692 2701
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 1 1 1 1 1 1 2 1
##
## 2716 2732 2741 2770 2779 2787 2788 2797 2807 2809 2811 2825 2826 2830
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 1 2 1 1 1 1 1 1
##
## 2836 2857 2873 2884 2891 2906 2915 2916 2931 2962 2965 2984 3016 3069
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1
##
## 3080 3088 3113 3119 3123 3130 3146 3154 3160 3166 3172 3196 3221 3222
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 1 2 1 1 1 1 1 1
##
## 3227 3238 3245 3251 3256 3277 3298 3309 3365 3380 3384 3404 3418 3556
## No 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1
In this dataset, the non-functioning observations have zero rented bikes. This makes the distinction between demand and availability of the service especially important.
My first visualization compares rented bike counts between functioning and non-functioning observations.
ggplot(bike, aes(x = `Functioning Day`, y = `Rented Bike Count`)) +
geom_boxplot() +
labs(
title = "Rented Bike Count by Functioning Day",
x = "Functioning Day",
y = "Rented Bike Count"
) +
theme_minimal()
The visualization shows a major difference between the two groups. When the system was not functioning, the rented bike count was zero.
The important insight is that zero rentals do not always mean zero demand. When the system was unavailable, customers did not have the opportunity to rent a bike.
This is significant because including non-functioning observations in a model of customer demand could make demand appear lower than it actually was.
I would want to know why the system was unavailable and whether the closures were planned or unexpected.
For another perspective, I looked at when functioning and non-functioning observations occurred throughout the dataset.
bike$DateParsed <- as.Date(bike$Date, format = "%d/%m/%Y")
ggplot(bike, aes(x = DateParsed, y = `Rented Bike Count`,
shape = `Functioning Day`)) +
geom_point(alpha = 0.4) +
labs(
title = "Bike Rentals Over Time by Functioning Status",
x = "Date",
y = "Rented Bike Count",
shape = "Functioning Day"
) +
theme_minimal()
This visualization allows me to see when non-functioning observations occurred in relation to normal rental activity. The non-functioning observations appear at zero rentals rather than following the normal variation in bike demand.
This makes it risky to interpret all zero rental observations in the same way. A zero caused by the system being unavailable has a different meaning from a zero that occurs while the system is operating.
Additional documentation explaining the reason for each non-functioning period would help determine whether these observations should be excluded, analyzed separately, or represented with another variable.
A significant risk is confusing system availability with customer demand. A model could learn that certain dates or conditions cause extremely low demand when the real reason for zero rentals was that the bike system was unavailable.
One way to reduce this risk would be to keep
Functioning Day in the analysis instead of ignoring it. If
the goal is specifically to model customer demand, I would also consider
analyzing only observations where Functioning Day is
Yes.
I would also document any decision to remove or separate non-functioning observations so that another person using the analysis understands why those observations were handled differently.
For this section, I investigated the categorical variables
Holiday and Seasons.
First, I checked the categories and explicit missing values.
table(bike$Holiday, useNA = "ifany")
##
## Holiday No Holiday
## 432 8328
sum(is.na(bike$Holiday))
## [1] 0
unique(bike$Holiday)
## [1] "No Holiday" "Holiday"
There are no explicit NA values in the
Holiday column.
I also checked the categories represented in the data. The dataset
contains both Holiday and No Holiday, so the
expected groups are represented.
I did not find explicitly missing values represented by
NA in this column.
I did not identify an obvious missing category from the documented values. However, this does not prove that every possible real-world holiday situation was recorded correctly.
Both documented groups contain observations, so I did not find an empty group.
This makes the Holiday variable relatively
straightforward to use, but its completeness still depends on how
accurately holidays were originally identified.
I would want to know what calendar or definition was used to determine which dates were classified as holidays.
Next, I investigated the Seasons column.
table(bike$Seasons, useNA = "ifany")
##
## Autumn Spring Summer Winter
## 2184 2208 2208 2160
sum(is.na(bike$Seasons))
## [1] 0
unique(bike$Seasons)
## [1] "Winter" "Spring" "Summer" "Autumn"
The dataset contains the categories Winter,
Spring, Summer, and Autumn.
There are no explicit NA values in the
Seasons column.
All four expected seasons appear in the dataset, so there is no obvious implicitly missing season.
None of the four season groups are empty.
Having all four seasons represented is important because bike demand can change throughout the year. If one season were absent, conclusions about seasonal differences could be incomplete.
I would want to know exactly how the dates separating one season from another were defined because different definitions of seasonal boundaries could slightly change the groups.
For the continuous variable, I chose
Rented Bike Count.
I used the interquartile range, or IQR, method to define outliers. An observation is considered an upper outlier if it is greater than:
Q3 + 1.5 × IQR
Q1 <- quantile(bike$`Rented Bike Count`, 0.25)
Q3 <- quantile(bike$`Rented Bike Count`, 0.75)
IQR_value <- IQR(bike$`Rented Bike Count`)
lower_bound <- Q1 - 1.5 * IQR_value
upper_bound <- Q3 + 1.5 * IQR_value
Q1
## 25%
## 191
Q3
## 75%
## 1065.25
IQR_value
## [1] 874.25
lower_bound
## 25%
## -1120.375
upper_bound
## 75%
## 2376.625
For this dataset, Q1 is 191, Q3 is 1065.25, and the IQR is 874.25. This gives an upper outlier threshold of approximately 2376.63 rented bikes.
Now I can identify observations above this threshold.
outliers <- bike %>%
filter(`Rented Bike Count` > upper_bound)
nrow(outliers)
## [1] 158
ggplot(bike, aes(y = `Rented Bike Count`)) +
geom_boxplot() +
labs(
title = "Outliers in Rented Bike Count",
y = "Rented Bike Count"
) +
theme_minimal()
Using this definition, unusually high rental counts can be identified systematically rather than deciding subjectively which values look large.
These observations should not automatically be deleted. A high rental count could represent a genuine period of unusually high bike demand rather than an error.
I would investigate whether these high rental counts are associated with particular hours, seasons, temperatures, or other conditions before deciding how they should be handled.
This Data Dive showed me that documentation is important for
understanding what variables actually represent.
Visibility (10m) and Functioning Day are
examples where interpreting the column name or values without additional
information could lead to mistakes.
The biggest issue I found was the lack of information explaining why the bike rental system was not functioning during certain observations. Because all non-functioning observations have zero rentals, treating them as ordinary demand observations could produce misleading conclusions.
I also found no explicit missing values in the two categorical
variables I investigated, and all expected categories were represented.
Finally, I used the IQR method to define possible outliers in
Rented Bike Count. These observations should be
investigated rather than automatically removed because they may
represent genuine periods of high demand.