Code
# Load the required packages
library(readr)
library(dplyr)
library(tidyr)
library(ggplot2)
# Import the original dataset
nycha <- read_csv(
"Data /NYCHA_Electric_Consumption_And_Cost.csv",
show_col_types = FALSE
)
# Display the number of rows and columns
dim(nycha)[1] 553666 27
Code
# Display the column names
names(nycha) [1] "Development Name" "Borough" "Account Name"
[4] "Location" "Meter AMR" "Meter Scope"
[7] "TDS #" "EDP" "RC Code"
[10] "Funding Source" "AMP #" "Vendor Name"
[13] "UMIS BILL ID" "Revenue Month" "Service Start Date"
[16] "Service End Date" "# days" "Meter Number"
[19] "Estimated" "Current Charges" "Rate Class"
[22] "Bill Analyzed" "Consumption (KWH)" "KWH Charges"
[25] "Consumption (KW)" "KW Charges" "Other charges"
Code
# Preview the first five observations
head(nycha, 5)# A tibble: 5 × 27
`Development Name` Borough `Account Name` Location `Meter AMR` `Meter Scope`
<chr> <chr> <chr> <chr> <chr> <chr>
1 ADAMS BRONX ADAMS BLD 05 NONE BLD 01 to 07
2 ADAMS BRONX ADAMS BLD 05 NONE BLD 01 to 07
3 ADAMS BRONX ADAMS BLD 05 NONE BLD 01 to 07
4 ADAMS BRONX ADAMS BLD 05 NONE BLD 01 to 07
5 ADAMS BRONX ADAMS BLD 05 NONE BLD 01 to 07
# ℹ 21 more variables: `TDS #` <dbl>, EDP <dbl>, `RC Code` <chr>,
# `Funding Source` <chr>, `AMP #` <chr>, `Vendor Name` <chr>,
# `UMIS BILL ID` <dbl>, `Revenue Month` <chr>, `Service Start Date` <chr>,
# `Service End Date` <chr>, `# days` <dbl>, `Meter Number` <chr>,
# Estimated <chr>, `Current Charges` <dbl>, `Rate Class` <chr>,
# `Bill Analyzed` <chr>, `Consumption (KWH)` <dbl>, `KWH Charges` <dbl>,
# `Consumption (KW)` <dbl>, `KW Charges` <dbl>, `Other charges` <dbl>
Code
# Examine the dataset structure
glimpse(nycha)Rows: 553,666
Columns: 27
$ `Development Name` <chr> "ADAMS", "ADAMS", "ADAMS", "ADAMS", "ADAMS", "ADA…
$ Borough <chr> "BRONX", "BRONX", "BRONX", "BRONX", "BRONX", "BRO…
$ `Account Name` <chr> "ADAMS", "ADAMS", "ADAMS", "ADAMS", "ADAMS", "ADA…
$ Location <chr> "BLD 05", "BLD 05", "BLD 05", "BLD 05", "BLD 05",…
$ `Meter AMR` <chr> "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "…
$ `Meter Scope` <chr> "BLD 01 to 07", "BLD 01 to 07", "BLD 01 to 07", "…
$ `TDS #` <dbl> 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,…
$ EDP <dbl> 248, 248, 248, 248, 248, 248, 248, 248, 248, 248,…
$ `RC Code` <chr> "B011800", "B011800", "B011800", "B011800", "B011…
$ `Funding Source` <chr> "FEDERAL", "FEDERAL", "FEDERAL", "FEDERAL", "FEDE…
$ `AMP #` <chr> "NY005001180P", "NY005001180P", "NY005001180P", "…
$ `Vendor Name` <chr> "NEW YORK POWER AUTHORITY", "NEW YORK POWER AUTHO…
$ `UMIS BILL ID` <dbl> 1842037, 1844205, 1841378, 1847148, 1848672, 1850…
$ `Revenue Month` <chr> "2010-01", "2010-02", "2010-03", "2010-04", "2010…
$ `Service Start Date` <chr> "12/24/2009", "01/26/2010", "02/25/2010", "03/26/…
$ `Service End Date` <chr> "01/26/2010", "02/25/2010", "03/26/2010", "04/26/…
$ `# days` <dbl> 33, 30, 29, 31, 28, 30, 30, 31, 30, 30, 31, 31, 3…
$ `Meter Number` <chr> "7223256", "7223256", "7223256", "7223256", "7223…
$ Estimated <chr> "N", "N", "N", "N", "N", "N", "N", "N", "N", "N",…
$ `Current Charges` <dbl> 15396.82, 14556.34, 13904.98, 14764.04, 13729.54,…
$ `Rate Class` <chr> "GOV/NYC/068", "GOV/NYC/068", "GOV/NYC/068", "GOV…
$ `Bill Analyzed` <chr> "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", …
$ `Consumption (KWH)` <dbl> 128800, 115200, 103200, 105600, 97600, 124000, 15…
$ `KWH Charges` <dbl> 7387.97, 6607.87, 5919.55, 6057.22, 5598.34, 7112…
$ `Consumption (KW)` <dbl> 216, 224, 216, 208, 216, 240, 296, 272, 280, 224,…
$ `KW Charges` <dbl> 2808, 2912, 2808, 2704, 2808, 3120, 3848, 3536, 3…
$ `Other charges` <dbl> 5200.85, 5036.47, 5177.43, 6002.82, 5323.20, 6456…