Create a .CSV file (or optionally, a MySQL database!) that includes all of the information included in the dataset. You’re encouraged to use a “wide” structure similar to how the information appears in the discussion item, so that you can practice tidying and transformations as described below.

Read the information from your .CSV file into R, and use tidyr and dplyr as needed to tidy and transform your data.

Perform the analysis requested in the discussion item. Your code should be in an R Markdown file, posted to rpubs.com, and should include narrative descriptions of your data cleanup work, analysis, and conclusions.

Data Loading

Dataset Preparation

Reading the Dataframe from a local CSV file.

house_dt <- read.csv("State_MedianRentalPricePerSqft_AllHomes.csv",stringsAsFactors = FALSE)

Original Dataset Dispplay

house_dt %>%
 kable() %>% 
          kable_styling(full_width = TRUE) %>% 
          scroll_box(width = "300")
RegionName SizeRank X2018.01 X2018.02 X2018.03 X2018.04 X2018.05 X2018.06 X2018.07 X2018.08 X2018.09 X2018.10 X2018.11 X2018.12
California 1 1.8674136 1.8846154 1.9001086 1.9235033 1.9478528 1.9563919 1.9519520 1.9389239 1.9215785 1.9117647 1.9245725 1.9344438
Texas 2 0.9056244 0.9134432 0.9237706 0.9344262 0.9387974 0.9400000 0.9373203 0.9320449 0.9276438 0.9252537 0.9281437 0.9318022
New York 3 4.2682584 4.2000000 3.9166667 4.1900000 4.3078412 4.0425532 3.8974345 3.4742328 3.2467532 3.1003876 3.1424668 3.5211268
Florida 4 1.3180646 1.3242778 1.3303769 1.3429752 1.3420245 1.3333333 1.3353116 1.3493800 1.3536748 1.3489209 1.3542038 1.3584906
Illinois 5 1.2173913 1.2288786 1.2594270 1.2901892 1.2925563 1.2996666 1.2840895 1.2759585 1.2681159 1.2653354 1.2568210 1.2536585
Pennsylvania 6 1.0256410 1.0351064 1.0568107 1.0817308 1.0890381 1.0804559 1.0574495 1.0512691 1.0416667 1.0341616 1.0380623 1.0416667
Ohio 7 0.8308895 0.8333333 0.8518253 0.8753501 0.8757962 0.8823529 0.8737500 0.8650519 0.8644860 0.8631620 0.8571429 0.8572797
Michigan 8 0.9340659 0.9398137 0.9791922 0.9926855 1.0000000 1.0000000 0.9963768 0.9900990 0.9904995 0.9911894 0.9817743 0.9825328
Georgia 9 0.7720669 0.7760652 0.7849378 0.7978723 0.8012821 0.8042895 0.8064516 0.7984533 0.7961783 0.8012821 0.8053221 0.8130081
North Carolina 10 0.7848527 0.7869712 0.8096527 0.8228266 0.8241758 0.8231707 0.8272059 0.8258892 0.8230453 0.8256881 0.8314220 0.8304196
New Jersey 11 1.4171254 1.4320786 1.4595091 1.4730721 1.4880952 1.4978158 1.4825879 1.4492754 1.4263518 1.4175258 1.4237691 1.4317181
Virginia 12 1.0593220 1.0628636 1.0714286 1.0894434 1.1000000 1.1040713 1.1211743 1.1114370 1.1011905 1.0830966 1.0910088 1.0984848
Washington 13 1.3164557 1.3030596 1.3191489 1.3436275 1.3727883 1.3677024 1.3663202 1.3453846 1.3361417 1.3207547 1.3079223 1.3075755
Massachusetts 14 2.4371595 2.5247971 2.6223529 2.6946108 2.7350427 2.7131783 2.6258206 2.5000000 2.3636364 2.2557287 2.2773279 2.3255814
Indiana 15 0.7788162 0.7785242 0.7938840 0.8064516 0.8091676 0.8079901 0.8074216 0.8039773 0.8123296 0.8103300 0.8084239 0.8073997
Arizona 16 0.9004302 0.9157088 0.9366838 0.9573579 0.9628255 0.9601182 0.9633028 0.9552067 0.9523810 0.9558824 0.9635417 0.9686147
Tennessee 17 0.8355091 0.8373206 0.8407738 0.8656103 0.8680556 0.8717105 0.8730159 0.8656873 0.8598909 0.8567512 0.8593190 0.8614556
Missouri 18 0.8413462 0.8468177 0.8488689 0.8683729 0.8668076 0.8771930 0.8752735 0.8800312 0.8873865 0.8857143 0.8781800 0.8695652
Maryland 19 1.2999071 1.2999102 1.3183594 1.3295613 1.3326226 1.3333333 1.3257576 1.3157895 1.3127854 1.3069705 1.3095238 1.3104013
Wisconsin 20 0.9812500 0.9722222 0.9900000 1.0000000 1.0033333 0.9775171 0.9629014 0.9643483 0.9596623 1.0000000 0.9866069 0.9950000
Minnesota 21 1.2150107 1.2061404 1.2062483 1.2171670 1.2213563 1.2244071 1.2293067 1.2331633 1.2252816 1.2397850 1.2387387 1.2481426
Colorado 22 1.4292115 1.4654617 1.4705882 1.4683153 1.4659926 1.4550071 1.4473684 1.4423077 1.4285714 1.4230091 1.4406780 1.4444444
Alabama 23 0.7044798 0.7082153 0.7186291 0.7276507 0.7246377 0.7292330 0.7283414 0.7246377 0.7252162 0.7252888 0.7333333 0.7322531
South Carolina 24 0.9127637 0.9247883 0.9320175 0.9477825 0.9590793 0.9521484 0.9543568 0.9393064 0.9360374 0.9376131 0.9427534 0.9483417
Louisiana 25 0.9006004 0.9000000 0.9210526 0.9287926 0.9353742 0.9315706 0.9317153 0.9184048 0.9115079 0.9046053 0.9001485 0.8951407
Kentucky 26 0.8352771 0.8581797 0.8708273 0.8888889 0.8997429 0.8888889 0.8830390 0.8731707 0.8645533 0.8740602 0.8632143 0.8627451
Oregon 27 1.1959177 1.2088839 1.2107143 1.2314815 1.2333333 1.2309496 1.2365176 1.2336980 1.2234930 1.2123439 1.2004573 1.1979167
Oklahoma 28 0.7700422 0.7793399 0.7860732 0.7997688 0.8000000 0.7969303 0.7960892 0.7903077 0.7896505 0.7829376 0.7847769 0.7851806
Connecticut 29 1.3211382 1.3446568 1.3689254 1.4210526 1.4159724 1.4058107 1.3840830 1.3636364 1.3541667 1.3495366 1.3419483 1.3454861
Iowa 30 0.9664621 0.9821429 0.9948980 0.9958202 0.9958333 0.9997061 0.9907530 0.9792708 0.9759203 0.9687500 0.9689922 0.9724663
Mississippi 31 0.7445141 0.7447799 0.7586207 0.7787105 0.7787325 0.7753140 0.7779466 0.7675439 0.7665042 0.7746303 0.7636837 0.7661385
Arkansas 32 0.7375388 0.7439246 0.7517135 0.7636519 0.7708726 0.7674415 0.7647059 0.7520460 0.7498558 0.7492292 0.7483278 0.7440476
Kansas 33 0.8593750 0.8658009 0.8750000 0.8816121 0.8931034 0.8819539 0.8832761 0.8771067 0.8578431 0.8504659 0.8561644 0.8689840
Utah 34 0.9839712 0.9989754 1.0294248 1.0302806 1.0382596 1.0545267 1.0586717 1.0560003 1.0455363 1.0353691 1.0412236 1.0389610
Nevada 35 0.8792049 0.8895381 0.9018759 0.9183673 0.9321301 0.9321886 0.9375000 0.9459459 0.9477459 0.9424603 0.9512289 0.9515571
New Mexico 36 0.8502888 0.8571429 0.8509705 0.8622184 0.8681171 0.8763592 0.8744533 0.8713480 0.8599931 0.8601948 0.8695652 0.8766234
West Virginia 37 0.7537105 0.7634527 0.7857143 0.7855273 0.7715171 0.7777778 0.7614213 0.7634228 0.7692308 0.7647059 0.7861635 0.7987466
Nebraska 38 1.0018133 1.0120350 1.0072640 1.0192737 1.0310734 1.0253454 1.0310734 1.0070053 1.0125184 0.9983832 0.9938838 1.0263864
Idaho 39 0.8420001 0.8511287 0.8696330 0.8916324 0.9204276 0.9444444 0.9567308 0.9437919 0.9398270 0.9370315 0.9229535 0.9117792
Hawaii 40 2.4372230 2.4620950 2.4311441 2.4471137 2.4794792 2.4640657 2.4193548 2.4417314 2.4296675 2.3733905 2.3645262 2.4132730
Maine 41 1.3020833 1.2648810 1.3603386 1.4099010 1.3925729 1.3950000 1.3313609 1.3206388 1.2985431 1.3086150 1.3254786 1.3443640
New Hampshire 42 1.2518968 1.2865235 1.2829175 1.3025940 1.2777778 1.3144059 1.3093944 1.3180366 1.3084112 1.2987013 1.2968487 1.2923851
Rhode Island 43 1.4843750 1.5261628 1.5642458 1.6176471 1.6000000 1.5963863 1.5102481 1.5000000 1.4880952 1.4750378 1.4903846 1.4914773
Montana 44 0.9756902 0.9939680 1.0000000 1.0056730 1.0618006 1.0708042 1.0762524 1.0869565 1.0631250 1.0470664 1.0410143 1.0212104
Delaware 45 0.9066667 0.9069767 0.9069767 0.9135332 0.9046537 0.9027373 0.9000000 0.9031593 0.9142857 0.9203791 0.9411765 0.9411765
South Dakota 46 0.8684211 0.8888889 0.9035420 0.9057971 0.9326647 0.9268293 0.9335597 0.9353742 0.9444444 0.9108232 0.9227799 0.9301310
Alaska 47 1.1781338 1.1975066 1.1955861 1.2046856 1.2033694 1.2222222 1.1970508 1.2000000 1.1935484 1.1804129 1.1753362 1.1956522
North Dakota 48 0.8805148 0.9055110 0.9180332 0.9883721 0.9259259 0.9166667 0.9233610 0.9416667 0.9416667 0.9375000 0.8866481 0.8788203
Vermont 49 1.4618877 1.5652174 1.5000000 1.5000000 1.4276240 1.3606811 1.3119534 1.3800000 1.5244783 1.5000000 1.3623737 1.3200000
District of Columbia 50 2.9614070 2.9590018 2.9706790 3.0524427 3.0960075 3.1250000 3.0775006 3.0196629 2.9702970 2.9328437 2.9455701 2.9785642
Wyoming 51 0.9123785 0.9286413 0.9369518 0.9308511 0.9464578 0.9475913 0.9642857 0.9505276 0.9635294 0.9738718 0.9961964 0.9927134

Data Wrangling

The first step to process the dataset is to convert all the years presented in the column as a row. Then the price field will store the corresponding values for each year. Then the months are grouped according to their combination of year and month and then a row that works as an index for the new dataframe is added because it is needed for spreading the data again and show each variable according to their month.Finally, all the rows are selected except the id generated for grouping purposes.

house_dt2 <- house_dt %>% gather("Year","Price",3:14) %>% 
  group_by(Year) %>%  mutate(idx=row_number()) %>% arrange(idx) %>% select(-idx)

Finally, columns year and month that were tied together are separated using the extract function in order to explit them in two columns.

house_dt2 <- house_dt2 %>% extract(Year,c("Year","Month"),"([0-9].+(?=\\.)).([0-9]{1,})")

Display of the processed dataframe.

house_dt2 %>%
 kable() %>% 
          kable_styling(full_width = TRUE) %>% 
          scroll_box(width = "100",height = "400px")
RegionName SizeRank Year Month Price
California 1 2018 01 1.8674136
California 1 2018 02 1.8846154
California 1 2018 03 1.9001086
California 1 2018 04 1.9235033
California 1 2018 05 1.9478528
California 1 2018 06 1.9563919
California 1 2018 07 1.9519520
California 1 2018 08 1.9389239
California 1 2018 09 1.9215785
California 1 2018 10 1.9117647
California 1 2018 11 1.9245725
California 1 2018 12 1.9344438
Texas 2 2018 01 0.9056244
Texas 2 2018 02 0.9134432
Texas 2 2018 03 0.9237706
Texas 2 2018 04 0.9344262
Texas 2 2018 05 0.9387974
Texas 2 2018 06 0.9400000
Texas 2 2018 07 0.9373203
Texas 2 2018 08 0.9320449
Texas 2 2018 09 0.9276438
Texas 2 2018 10 0.9252537
Texas 2 2018 11 0.9281437
Texas 2 2018 12 0.9318022
New York 3 2018 01 4.2682584
New York 3 2018 02 4.2000000
New York 3 2018 03 3.9166667
New York 3 2018 04 4.1900000
New York 3 2018 05 4.3078412
New York 3 2018 06 4.0425532
New York 3 2018 07 3.8974345
New York 3 2018 08 3.4742328
New York 3 2018 09 3.2467532
New York 3 2018 10 3.1003876
New York 3 2018 11 3.1424668
New York 3 2018 12 3.5211268
Florida 4 2018 01 1.3180646
Florida 4 2018 02 1.3242778
Florida 4 2018 03 1.3303769
Florida 4 2018 04 1.3429752
Florida 4 2018 05 1.3420245
Florida 4 2018 06 1.3333333
Florida 4 2018 07 1.3353116
Florida 4 2018 08 1.3493800
Florida 4 2018 09 1.3536748
Florida 4 2018 10 1.3489209
Florida 4 2018 11 1.3542038
Florida 4 2018 12 1.3584906
Illinois 5 2018 01 1.2173913
Illinois 5 2018 02 1.2288786
Illinois 5 2018 03 1.2594270
Illinois 5 2018 04 1.2901892
Illinois 5 2018 05 1.2925563
Illinois 5 2018 06 1.2996666
Illinois 5 2018 07 1.2840895
Illinois 5 2018 08 1.2759585
Illinois 5 2018 09 1.2681159
Illinois 5 2018 10 1.2653354
Illinois 5 2018 11 1.2568210
Illinois 5 2018 12 1.2536585
Pennsylvania 6 2018 01 1.0256410
Pennsylvania 6 2018 02 1.0351064
Pennsylvania 6 2018 03 1.0568107
Pennsylvania 6 2018 04 1.0817308
Pennsylvania 6 2018 05 1.0890381
Pennsylvania 6 2018 06 1.0804559
Pennsylvania 6 2018 07 1.0574495
Pennsylvania 6 2018 08 1.0512691
Pennsylvania 6 2018 09 1.0416667
Pennsylvania 6 2018 10 1.0341616
Pennsylvania 6 2018 11 1.0380623
Pennsylvania 6 2018 12 1.0416667
Ohio 7 2018 01 0.8308895
Ohio 7 2018 02 0.8333333
Ohio 7 2018 03 0.8518253
Ohio 7 2018 04 0.8753501
Ohio 7 2018 05 0.8757962
Ohio 7 2018 06 0.8823529
Ohio 7 2018 07 0.8737500
Ohio 7 2018 08 0.8650519
Ohio 7 2018 09 0.8644860
Ohio 7 2018 10 0.8631620
Ohio 7 2018 11 0.8571429
Ohio 7 2018 12 0.8572797
Michigan 8 2018 01 0.9340659
Michigan 8 2018 02 0.9398137
Michigan 8 2018 03 0.9791922
Michigan 8 2018 04 0.9926855
Michigan 8 2018 05 1.0000000
Michigan 8 2018 06 1.0000000
Michigan 8 2018 07 0.9963768
Michigan 8 2018 08 0.9900990
Michigan 8 2018 09 0.9904995
Michigan 8 2018 10 0.9911894
Michigan 8 2018 11 0.9817743
Michigan 8 2018 12 0.9825328
Georgia 9 2018 01 0.7720669
Georgia 9 2018 02 0.7760652
Georgia 9 2018 03 0.7849378
Georgia 9 2018 04 0.7978723
Georgia 9 2018 05 0.8012821
Georgia 9 2018 06 0.8042895
Georgia 9 2018 07 0.8064516
Georgia 9 2018 08 0.7984533
Georgia 9 2018 09 0.7961783
Georgia 9 2018 10 0.8012821
Georgia 9 2018 11 0.8053221
Georgia 9 2018 12 0.8130081
North Carolina 10 2018 01 0.7848527
North Carolina 10 2018 02 0.7869712
North Carolina 10 2018 03 0.8096527
North Carolina 10 2018 04 0.8228266
North Carolina 10 2018 05 0.8241758
North Carolina 10 2018 06 0.8231707
North Carolina 10 2018 07 0.8272059
North Carolina 10 2018 08 0.8258892
North Carolina 10 2018 09 0.8230453
North Carolina 10 2018 10 0.8256881
North Carolina 10 2018 11 0.8314220
North Carolina 10 2018 12 0.8304196
New Jersey 11 2018 01 1.4171254
New Jersey 11 2018 02 1.4320786
New Jersey 11 2018 03 1.4595091
New Jersey 11 2018 04 1.4730721
New Jersey 11 2018 05 1.4880952
New Jersey 11 2018 06 1.4978158
New Jersey 11 2018 07 1.4825879
New Jersey 11 2018 08 1.4492754
New Jersey 11 2018 09 1.4263518
New Jersey 11 2018 10 1.4175258
New Jersey 11 2018 11 1.4237691
New Jersey 11 2018 12 1.4317181
Virginia 12 2018 01 1.0593220
Virginia 12 2018 02 1.0628636
Virginia 12 2018 03 1.0714286
Virginia 12 2018 04 1.0894434
Virginia 12 2018 05 1.1000000
Virginia 12 2018 06 1.1040713
Virginia 12 2018 07 1.1211743
Virginia 12 2018 08 1.1114370
Virginia 12 2018 09 1.1011905
Virginia 12 2018 10 1.0830966
Virginia 12 2018 11 1.0910088
Virginia 12 2018 12 1.0984848
Washington 13 2018 01 1.3164557
Washington 13 2018 02 1.3030596
Washington 13 2018 03 1.3191489
Washington 13 2018 04 1.3436275
Washington 13 2018 05 1.3727883
Washington 13 2018 06 1.3677024
Washington 13 2018 07 1.3663202
Washington 13 2018 08 1.3453846
Washington 13 2018 09 1.3361417
Washington 13 2018 10 1.3207547
Washington 13 2018 11 1.3079223
Washington 13 2018 12 1.3075755
Massachusetts 14 2018 01 2.4371595
Massachusetts 14 2018 02 2.5247971
Massachusetts 14 2018 03 2.6223529
Massachusetts 14 2018 04 2.6946108
Massachusetts 14 2018 05 2.7350427
Massachusetts 14 2018 06 2.7131783
Massachusetts 14 2018 07 2.6258206
Massachusetts 14 2018 08 2.5000000
Massachusetts 14 2018 09 2.3636364
Massachusetts 14 2018 10 2.2557287
Massachusetts 14 2018 11 2.2773279
Massachusetts 14 2018 12 2.3255814
Indiana 15 2018 01 0.7788162
Indiana 15 2018 02 0.7785242
Indiana 15 2018 03 0.7938840
Indiana 15 2018 04 0.8064516
Indiana 15 2018 05 0.8091676
Indiana 15 2018 06 0.8079901
Indiana 15 2018 07 0.8074216
Indiana 15 2018 08 0.8039773
Indiana 15 2018 09 0.8123296
Indiana 15 2018 10 0.8103300
Indiana 15 2018 11 0.8084239
Indiana 15 2018 12 0.8073997
Arizona 16 2018 01 0.9004302
Arizona 16 2018 02 0.9157088
Arizona 16 2018 03 0.9366838
Arizona 16 2018 04 0.9573579
Arizona 16 2018 05 0.9628255
Arizona 16 2018 06 0.9601182
Arizona 16 2018 07 0.9633028
Arizona 16 2018 08 0.9552067
Arizona 16 2018 09 0.9523810
Arizona 16 2018 10 0.9558824
Arizona 16 2018 11 0.9635417
Arizona 16 2018 12 0.9686147
Tennessee 17 2018 01 0.8355091
Tennessee 17 2018 02 0.8373206
Tennessee 17 2018 03 0.8407738
Tennessee 17 2018 04 0.8656103
Tennessee 17 2018 05 0.8680556
Tennessee 17 2018 06 0.8717105
Tennessee 17 2018 07 0.8730159
Tennessee 17 2018 08 0.8656873
Tennessee 17 2018 09 0.8598909
Tennessee 17 2018 10 0.8567512
Tennessee 17 2018 11 0.8593190
Tennessee 17 2018 12 0.8614556
Missouri 18 2018 01 0.8413462
Missouri 18 2018 02 0.8468177
Missouri 18 2018 03 0.8488689
Missouri 18 2018 04 0.8683729
Missouri 18 2018 05 0.8668076
Missouri 18 2018 06 0.8771930
Missouri 18 2018 07 0.8752735
Missouri 18 2018 08 0.8800312
Missouri 18 2018 09 0.8873865
Missouri 18 2018 10 0.8857143
Missouri 18 2018 11 0.8781800
Missouri 18 2018 12 0.8695652
Maryland 19 2018 01 1.2999071
Maryland 19 2018 02 1.2999102
Maryland 19 2018 03 1.3183594
Maryland 19 2018 04 1.3295613
Maryland 19 2018 05 1.3326226
Maryland 19 2018 06 1.3333333
Maryland 19 2018 07 1.3257576
Maryland 19 2018 08 1.3157895
Maryland 19 2018 09 1.3127854
Maryland 19 2018 10 1.3069705
Maryland 19 2018 11 1.3095238
Maryland 19 2018 12 1.3104013
Wisconsin 20 2018 01 0.9812500
Wisconsin 20 2018 02 0.9722222
Wisconsin 20 2018 03 0.9900000
Wisconsin 20 2018 04 1.0000000
Wisconsin 20 2018 05 1.0033333
Wisconsin 20 2018 06 0.9775171
Wisconsin 20 2018 07 0.9629014
Wisconsin 20 2018 08 0.9643483
Wisconsin 20 2018 09 0.9596623
Wisconsin 20 2018 10 1.0000000
Wisconsin 20 2018 11 0.9866069
Wisconsin 20 2018 12 0.9950000
Minnesota 21 2018 01 1.2150107
Minnesota 21 2018 02 1.2061404
Minnesota 21 2018 03 1.2062483
Minnesota 21 2018 04 1.2171670
Minnesota 21 2018 05 1.2213563
Minnesota 21 2018 06 1.2244071
Minnesota 21 2018 07 1.2293067
Minnesota 21 2018 08 1.2331633
Minnesota 21 2018 09 1.2252816
Minnesota 21 2018 10 1.2397850
Minnesota 21 2018 11 1.2387387
Minnesota 21 2018 12 1.2481426
Colorado 22 2018 01 1.4292115
Colorado 22 2018 02 1.4654617
Colorado 22 2018 03 1.4705882
Colorado 22 2018 04 1.4683153
Colorado 22 2018 05 1.4659926
Colorado 22 2018 06 1.4550071
Colorado 22 2018 07 1.4473684
Colorado 22 2018 08 1.4423077
Colorado 22 2018 09 1.4285714
Colorado 22 2018 10 1.4230091
Colorado 22 2018 11 1.4406780
Colorado 22 2018 12 1.4444444
Alabama 23 2018 01 0.7044798
Alabama 23 2018 02 0.7082153
Alabama 23 2018 03 0.7186291
Alabama 23 2018 04 0.7276507
Alabama 23 2018 05 0.7246377
Alabama 23 2018 06 0.7292330
Alabama 23 2018 07 0.7283414
Alabama 23 2018 08 0.7246377
Alabama 23 2018 09 0.7252162
Alabama 23 2018 10 0.7252888
Alabama 23 2018 11 0.7333333
Alabama 23 2018 12 0.7322531
South Carolina 24 2018 01 0.9127637
South Carolina 24 2018 02 0.9247883
South Carolina 24 2018 03 0.9320175
South Carolina 24 2018 04 0.9477825
South Carolina 24 2018 05 0.9590793
South Carolina 24 2018 06 0.9521484
South Carolina 24 2018 07 0.9543568
South Carolina 24 2018 08 0.9393064
South Carolina 24 2018 09 0.9360374
South Carolina 24 2018 10 0.9376131
South Carolina 24 2018 11 0.9427534
South Carolina 24 2018 12 0.9483417
Louisiana 25 2018 01 0.9006004
Louisiana 25 2018 02 0.9000000
Louisiana 25 2018 03 0.9210526
Louisiana 25 2018 04 0.9287926
Louisiana 25 2018 05 0.9353742
Louisiana 25 2018 06 0.9315706
Louisiana 25 2018 07 0.9317153
Louisiana 25 2018 08 0.9184048
Louisiana 25 2018 09 0.9115079
Louisiana 25 2018 10 0.9046053
Louisiana 25 2018 11 0.9001485
Louisiana 25 2018 12 0.8951407
Kentucky 26 2018 01 0.8352771
Kentucky 26 2018 02 0.8581797
Kentucky 26 2018 03 0.8708273
Kentucky 26 2018 04 0.8888889
Kentucky 26 2018 05 0.8997429
Kentucky 26 2018 06 0.8888889
Kentucky 26 2018 07 0.8830390
Kentucky 26 2018 08 0.8731707
Kentucky 26 2018 09 0.8645533
Kentucky 26 2018 10 0.8740602
Kentucky 26 2018 11 0.8632143
Kentucky 26 2018 12 0.8627451
Oregon 27 2018 01 1.1959177
Oregon 27 2018 02 1.2088839
Oregon 27 2018 03 1.2107143
Oregon 27 2018 04 1.2314815
Oregon 27 2018 05 1.2333333
Oregon 27 2018 06 1.2309496
Oregon 27 2018 07 1.2365176
Oregon 27 2018 08 1.2336980
Oregon 27 2018 09 1.2234930
Oregon 27 2018 10 1.2123439
Oregon 27 2018 11 1.2004573
Oregon 27 2018 12 1.1979167
Oklahoma 28 2018 01 0.7700422
Oklahoma 28 2018 02 0.7793399
Oklahoma 28 2018 03 0.7860732
Oklahoma 28 2018 04 0.7997688
Oklahoma 28 2018 05 0.8000000
Oklahoma 28 2018 06 0.7969303
Oklahoma 28 2018 07 0.7960892
Oklahoma 28 2018 08 0.7903077
Oklahoma 28 2018 09 0.7896505
Oklahoma 28 2018 10 0.7829376
Oklahoma 28 2018 11 0.7847769
Oklahoma 28 2018 12 0.7851806
Connecticut 29 2018 01 1.3211382
Connecticut 29 2018 02 1.3446568
Connecticut 29 2018 03 1.3689254
Connecticut 29 2018 04 1.4210526
Connecticut 29 2018 05 1.4159724
Connecticut 29 2018 06 1.4058107
Connecticut 29 2018 07 1.3840830
Connecticut 29 2018 08 1.3636364
Connecticut 29 2018 09 1.3541667
Connecticut 29 2018 10 1.3495366
Connecticut 29 2018 11 1.3419483
Connecticut 29 2018 12 1.3454861
Iowa 30 2018 01 0.9664621
Iowa 30 2018 02 0.9821429
Iowa 30 2018 03 0.9948980
Iowa 30 2018 04 0.9958202
Iowa 30 2018 05 0.9958333
Iowa 30 2018 06 0.9997061
Iowa 30 2018 07 0.9907530
Iowa 30 2018 08 0.9792708
Iowa 30 2018 09 0.9759203
Iowa 30 2018 10 0.9687500
Iowa 30 2018 11 0.9689922
Iowa 30 2018 12 0.9724663
Mississippi 31 2018 01 0.7445141
Mississippi 31 2018 02 0.7447799
Mississippi 31 2018 03 0.7586207
Mississippi 31 2018 04 0.7787105
Mississippi 31 2018 05 0.7787325
Mississippi 31 2018 06 0.7753140
Mississippi 31 2018 07 0.7779466
Mississippi 31 2018 08 0.7675439
Mississippi 31 2018 09 0.7665042
Mississippi 31 2018 10 0.7746303
Mississippi 31 2018 11 0.7636837
Mississippi 31 2018 12 0.7661385
Arkansas 32 2018 01 0.7375388
Arkansas 32 2018 02 0.7439246
Arkansas 32 2018 03 0.7517135
Arkansas 32 2018 04 0.7636519
Arkansas 32 2018 05 0.7708726
Arkansas 32 2018 06 0.7674415
Arkansas 32 2018 07 0.7647059
Arkansas 32 2018 08 0.7520460
Arkansas 32 2018 09 0.7498558
Arkansas 32 2018 10 0.7492292
Arkansas 32 2018 11 0.7483278
Arkansas 32 2018 12 0.7440476
Kansas 33 2018 01 0.8593750
Kansas 33 2018 02 0.8658009
Kansas 33 2018 03 0.8750000
Kansas 33 2018 04 0.8816121
Kansas 33 2018 05 0.8931034
Kansas 33 2018 06 0.8819539
Kansas 33 2018 07 0.8832761
Kansas 33 2018 08 0.8771067
Kansas 33 2018 09 0.8578431
Kansas 33 2018 10 0.8504659
Kansas 33 2018 11 0.8561644
Kansas 33 2018 12 0.8689840
Utah 34 2018 01 0.9839712
Utah 34 2018 02 0.9989754
Utah 34 2018 03 1.0294248
Utah 34 2018 04 1.0302806
Utah 34 2018 05 1.0382596
Utah 34 2018 06 1.0545267
Utah 34 2018 07 1.0586717
Utah 34 2018 08 1.0560003
Utah 34 2018 09 1.0455363
Utah 34 2018 10 1.0353691
Utah 34 2018 11 1.0412236
Utah 34 2018 12 1.0389610
Nevada 35 2018 01 0.8792049
Nevada 35 2018 02 0.8895381
Nevada 35 2018 03 0.9018759
Nevada 35 2018 04 0.9183673
Nevada 35 2018 05 0.9321301
Nevada 35 2018 06 0.9321886
Nevada 35 2018 07 0.9375000
Nevada 35 2018 08 0.9459459
Nevada 35 2018 09 0.9477459
Nevada 35 2018 10 0.9424603
Nevada 35 2018 11 0.9512289
Nevada 35 2018 12 0.9515571
New Mexico 36 2018 01 0.8502888
New Mexico 36 2018 02 0.8571429
New Mexico 36 2018 03 0.8509705
New Mexico 36 2018 04 0.8622184
New Mexico 36 2018 05 0.8681171
New Mexico 36 2018 06 0.8763592
New Mexico 36 2018 07 0.8744533
New Mexico 36 2018 08 0.8713480
New Mexico 36 2018 09 0.8599931
New Mexico 36 2018 10 0.8601948
New Mexico 36 2018 11 0.8695652
New Mexico 36 2018 12 0.8766234
West Virginia 37 2018 01 0.7537105
West Virginia 37 2018 02 0.7634527
West Virginia 37 2018 03 0.7857143
West Virginia 37 2018 04 0.7855273
West Virginia 37 2018 05 0.7715171
West Virginia 37 2018 06 0.7777778
West Virginia 37 2018 07 0.7614213
West Virginia 37 2018 08 0.7634228
West Virginia 37 2018 09 0.7692308
West Virginia 37 2018 10 0.7647059
West Virginia 37 2018 11 0.7861635
West Virginia 37 2018 12 0.7987466
Nebraska 38 2018 01 1.0018133
Nebraska 38 2018 02 1.0120350
Nebraska 38 2018 03 1.0072640
Nebraska 38 2018 04 1.0192737
Nebraska 38 2018 05 1.0310734
Nebraska 38 2018 06 1.0253454
Nebraska 38 2018 07 1.0310734
Nebraska 38 2018 08 1.0070053
Nebraska 38 2018 09 1.0125184
Nebraska 38 2018 10 0.9983832
Nebraska 38 2018 11 0.9938838
Nebraska 38 2018 12 1.0263864
Idaho 39 2018 01 0.8420001
Idaho 39 2018 02 0.8511287
Idaho 39 2018 03 0.8696330
Idaho 39 2018 04 0.8916324
Idaho 39 2018 05 0.9204276
Idaho 39 2018 06 0.9444444
Idaho 39 2018 07 0.9567308
Idaho 39 2018 08 0.9437919
Idaho 39 2018 09 0.9398270
Idaho 39 2018 10 0.9370315
Idaho 39 2018 11 0.9229535
Idaho 39 2018 12 0.9117792
Hawaii 40 2018 01 2.4372230
Hawaii 40 2018 02 2.4620950
Hawaii 40 2018 03 2.4311441
Hawaii 40 2018 04 2.4471137
Hawaii 40 2018 05 2.4794792
Hawaii 40 2018 06 2.4640657
Hawaii 40 2018 07 2.4193548
Hawaii 40 2018 08 2.4417314
Hawaii 40 2018 09 2.4296675
Hawaii 40 2018 10 2.3733905
Hawaii 40 2018 11 2.3645262
Hawaii 40 2018 12 2.4132730
Maine 41 2018 01 1.3020833
Maine 41 2018 02 1.2648810
Maine 41 2018 03 1.3603386
Maine 41 2018 04 1.4099010
Maine 41 2018 05 1.3925729
Maine 41 2018 06 1.3950000
Maine 41 2018 07 1.3313609
Maine 41 2018 08 1.3206388
Maine 41 2018 09 1.2985431
Maine 41 2018 10 1.3086150
Maine 41 2018 11 1.3254786
Maine 41 2018 12 1.3443640
New Hampshire 42 2018 01 1.2518968
New Hampshire 42 2018 02 1.2865235
New Hampshire 42 2018 03 1.2829175
New Hampshire 42 2018 04 1.3025940
New Hampshire 42 2018 05 1.2777778
New Hampshire 42 2018 06 1.3144059
New Hampshire 42 2018 07 1.3093944
New Hampshire 42 2018 08 1.3180366
New Hampshire 42 2018 09 1.3084112
New Hampshire 42 2018 10 1.2987013
New Hampshire 42 2018 11 1.2968487
New Hampshire 42 2018 12 1.2923851
Rhode Island 43 2018 01 1.4843750
Rhode Island 43 2018 02 1.5261628
Rhode Island 43 2018 03 1.5642458
Rhode Island 43 2018 04 1.6176471
Rhode Island 43 2018 05 1.6000000
Rhode Island 43 2018 06 1.5963863
Rhode Island 43 2018 07 1.5102481
Rhode Island 43 2018 08 1.5000000
Rhode Island 43 2018 09 1.4880952
Rhode Island 43 2018 10 1.4750378
Rhode Island 43 2018 11 1.4903846
Rhode Island 43 2018 12 1.4914773
Montana 44 2018 01 0.9756902
Montana 44 2018 02 0.9939680
Montana 44 2018 03 1.0000000
Montana 44 2018 04 1.0056730
Montana 44 2018 05 1.0618006
Montana 44 2018 06 1.0708042
Montana 44 2018 07 1.0762524
Montana 44 2018 08 1.0869565
Montana 44 2018 09 1.0631250
Montana 44 2018 10 1.0470664
Montana 44 2018 11 1.0410143
Montana 44 2018 12 1.0212104
Delaware 45 2018 01 0.9066667
Delaware 45 2018 02 0.9069767
Delaware 45 2018 03 0.9069767
Delaware 45 2018 04 0.9135332
Delaware 45 2018 05 0.9046537
Delaware 45 2018 06 0.9027373
Delaware 45 2018 07 0.9000000
Delaware 45 2018 08 0.9031593
Delaware 45 2018 09 0.9142857
Delaware 45 2018 10 0.9203791
Delaware 45 2018 11 0.9411765
Delaware 45 2018 12 0.9411765
South Dakota 46 2018 01 0.8684211
South Dakota 46 2018 02 0.8888889
South Dakota 46 2018 03 0.9035420
South Dakota 46 2018 04 0.9057971
South Dakota 46 2018 05 0.9326647
South Dakota 46 2018 06 0.9268293
South Dakota 46 2018 07 0.9335597
South Dakota 46 2018 08 0.9353742
South Dakota 46 2018 09 0.9444444
South Dakota 46 2018 10 0.9108232
South Dakota 46 2018 11 0.9227799
South Dakota 46 2018 12 0.9301310
Alaska 47 2018 01 1.1781338
Alaska 47 2018 02 1.1975066
Alaska 47 2018 03 1.1955861
Alaska 47 2018 04 1.2046856
Alaska 47 2018 05 1.2033694
Alaska 47 2018 06 1.2222222
Alaska 47 2018 07 1.1970508
Alaska 47 2018 08 1.2000000
Alaska 47 2018 09 1.1935484
Alaska 47 2018 10 1.1804129
Alaska 47 2018 11 1.1753362
Alaska 47 2018 12 1.1956522
North Dakota 48 2018 01 0.8805148
North Dakota 48 2018 02 0.9055110
North Dakota 48 2018 03 0.9180332
North Dakota 48 2018 04 0.9883721
North Dakota 48 2018 05 0.9259259
North Dakota 48 2018 06 0.9166667
North Dakota 48 2018 07 0.9233610
North Dakota 48 2018 08 0.9416667
North Dakota 48 2018 09 0.9416667
North Dakota 48 2018 10 0.9375000
North Dakota 48 2018 11 0.8866481
North Dakota 48 2018 12 0.8788203
Vermont 49 2018 01 1.4618877
Vermont 49 2018 02 1.5652174
Vermont 49 2018 03 1.5000000
Vermont 49 2018 04 1.5000000
Vermont 49 2018 05 1.4276240
Vermont 49 2018 06 1.3606811
Vermont 49 2018 07 1.3119534
Vermont 49 2018 08 1.3800000
Vermont 49 2018 09 1.5244783
Vermont 49 2018 10 1.5000000
Vermont 49 2018 11 1.3623737
Vermont 49 2018 12 1.3200000
District of Columbia 50 2018 01 2.9614070
District of Columbia 50 2018 02 2.9590018
District of Columbia 50 2018 03 2.9706790
District of Columbia 50 2018 04 3.0524427
District of Columbia 50 2018 05 3.0960075
District of Columbia 50 2018 06 3.1250000
District of Columbia 50 2018 07 3.0775006
District of Columbia 50 2018 08 3.0196629
District of Columbia 50 2018 09 2.9702970
District of Columbia 50 2018 10 2.9328437
District of Columbia 50 2018 11 2.9455701
District of Columbia 50 2018 12 2.9785642
Wyoming 51 2018 01 0.9123785
Wyoming 51 2018 02 0.9286413
Wyoming 51 2018 03 0.9369518
Wyoming 51 2018 04 0.9308511
Wyoming 51 2018 05 0.9464578
Wyoming 51 2018 06 0.9475913
Wyoming 51 2018 07 0.9642857
Wyoming 51 2018 08 0.9505276
Wyoming 51 2018 09 0.9635294
Wyoming 51 2018 10 0.9738718
Wyoming 51 2018 11 0.9961964
Wyoming 51 2018 12 0.9927134

Analysis

For the analysis part,I am going to check

Average price in New York City for each month of 2018

new_y <- house_dt2 %>% filter(RegionName == "New York")

new_y %>% 
  ggplot(aes(x = Month, y = as.numeric(Price)))+geom_bar(stat = "identity")+labs(title = "Average Home Prices for New York by Month")+xlab("Months")+ylab("Price")

As show in the graph the distribution of prices during the year was nearly uniform which suggest that prices oscillates about the same range of prices.

states_m <- c()
states <-  levels(as.factor(house_dt2$RegionName))
#this loop summarises the mean prices for each state and save them in order to plot them lately
for (i in states) {
  states_m <- c(states_m,  
                house_dt2 %>% 
                summarise(mean= mean(.$Price[.$RegionName==i]))
                )
}

 ggplot(NULL,aes(x = reorder(states,as.numeric(states_m)), y = states_m))+geom_bar(stat = "identity")+labs(title = "Average Home Prices for US states ")+xlab("Price")+ylab("State")+coord_flip()

As shown in the graph, the most explensive rent belongs to New York City and secondly the Distric of Culumbia. At the end, Alabama and Arkansas are the places with cheaper rent per square feet.