MedSale<-read.csv("MeDian_Sale_Prices_2012-2024.csv")
MedSale2224<-read.csv("Median_Sales_Prices2022-AUG2024.csv")
##Packages
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ readr 2.1.5
## ✔ ggplot2 3.5.1 ✔ stringr 1.5.1
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(reshape2)
##
## Attaching package: 'reshape2'
##
## The following object is masked from 'package:tidyr':
##
## smiths
Long<-
MedSale %>%
pivot_longer(
cols=!Region,
names_to = "Date",
values_to = "Median_Prices") %>%
print()
## # A tibble: 1,064 × 3
## Region Date Median_Prices
## <chr> <chr> <chr>
## 1 " National" Jan.12 "$159,000 "
## 2 " National" Feb.12 "$160,000 "
## 3 " National" Mar.12 "$171,000 "
## 4 " National" Apr.12 "$178,000 "
## 5 " National" May.12 "$186,000 "
## 6 " National" Jun.12 "$194,000 "
## 7 " National" Jul.12 "$192,000 "
## 8 " National" Aug.12 "$191,000 "
## 9 " National" Sep.12 "$187,000 "
## 10 " National" Oct.12 "$185,000 "
## # ℹ 1,054 more rows
Wide<-
MedSale2224 %>%
pivot_wider(
names_from = "PeriodEnd",
values_from = "MedianSale") %>%
print()
## # A tibble: 7 × 33
## Region `22-Jan` `22-Feb` `22-Mar` `22-Apr` `22-May` `22-Jun` `22-Jul` `22-Aug`
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 " Nat… "$378 " "$392 " "$415 " "$426 " "$433 " "$429 " "$415 " "$409 "
## 2 "Bost… "$596 " "$595 " "$637 " "$675 " "$690 " "$705 " "$687 " "$675 "
## 3 "Chic… "$290 " "$292 " "$310 " "$328 " "$329 " "$340 " "$325 " "$310 "
## 4 "Los … "$825 " "$840 " "$875 " "$900 " "$900 " "$890 " "$862 " "$845 "
## 5 "Phil… "$250 " "$250 " "$265 " "$275 " "$287 " "$297 " "$280 " "$275 "
## 6 "Seat… "$720 " "$751 " "$825 " "$851 " "$853 " "$825 " "$798 " "$780 "
## 7 "Wash… "$475 " "$496 " "$525 " "$550 " "$555 " "$550 " "$530 " "$520 "
## # ℹ 24 more variables: `22-Sep` <chr>, `22-Oct` <chr>, `22-Nov` <chr>,
## # `22-Dec` <chr>, `23-Jan` <chr>, `23-Feb` <chr>, `23-Mar` <chr>,
## # `23-Apr` <chr>, `23-May` <chr>, `23-Jun` <chr>, `23-Jul` <chr>,
## # `23-Aug` <chr>, `23-Sep` <chr>, `23-Oct` <chr>, `23-Nov` <chr>,
## # `23-Dec` <chr>, `24-Jan` <chr>, `24-Feb` <chr>, `24-Mar` <chr>,
## # `24-Apr` <chr>, `24-May` <chr>, `24-Jun` <chr>, `24-Jul` <chr>,
## # `24-Aug` <chr>
##Describe a row
Wide Format: Each row represents a region, with separate columns for median home sale prices on for each month from 2012 to August 2024.
Long format: Each row represents the median home sale price for a region in a specific month.