library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.2 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4
## ── 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
tvshows<-read_csv("tvshows.csv")
## Rows: 40 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): Show, Network, Genre
## dbl (3): PE, GRP, Duration
##
## ℹ 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.
tvshows<-read_csv("tvshows.csv")
## Rows: 40 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): Show, Network, Genre
## dbl (3): PE, GRP, Duration
##
## ℹ 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.
head(tvshows)
## # A tibble: 6 × 6
## Show Network PE GRP Genre Duration
## <chr> <chr> <dbl> <dbl> <chr> <dbl>
## 1 Living with Ed HGTV 54 151 Reality 30
## 2 Monarch Cove LIFE 64.6 376. Drama/Adventu… 60
## 3 Top Chef BRAVO 78.6 808. Reality 60
## 4 Iron Chef America FOOD 62.6 17.3 Reality 30
## 5 Trading Spaces: All Stars TLC 56 44.1 Reality 60
## 6 Lisa Williams: Life Among the Dead LIFE 56.2 383. Reality 60
ggplot(tvshows,aes(GRP,PE))+
geom_point()

ggplot(tvshows,aes(GRP,PE,col))+
geom_point()

ggplot(tvshows,aes(GRP,PE,shape=Genre))+
geom_point()

ggplot(tvshows,aes(GRP,PE))+
geom_point()+
facet_wrap(~Genre)

power_christmas2015<-read_csv("power_christmas2015.csv")
## Rows: 24 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): hour, ERCOT
##
## ℹ 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.
head(power_christmas2015)
## # A tibble: 6 × 2
## hour ERCOT
## <dbl> <dbl>
## 1 0 31209.
## 2 1 29631.
## 3 2 28487.
## 4 3 27650.
## 5 4 27212.
## 6 5 27234.
ggplot(power_christmas2015,aes(hour,ERCOT))+
geom_line()

rapidcity<-read_csv("rapidcity.csv")
## Rows: 6159 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (4): Year, Month, Day, Temp
##
## ℹ 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.
head(rapidcity)
## # A tibble: 6 × 4
## Year Month Day Temp
## <dbl> <dbl> <dbl> <dbl>
## 1 1995 1 1 12.6
## 2 1995 1 2 19.9
## 3 1995 1 3 9.2
## 4 1995 1 4 6.2
## 5 1995 1 5 16
## 6 1995 1 6 17.8
ggplot(rapidcity,aes(Temp))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(rapidcity,aes(Temp),binwidth=1)+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(rapidcity,aes(Temp),binwidth=20)+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(rapidcity,aes(Temp),binwidth=3)+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(rapidcity,aes(Temp),binwidth=3)+
geom_histogram()+
facet_wrap(~Month)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(rapidcity, aes(Temp), binwidth=3)+
geom_histogram()+
facet_wrap(~Month, nrow = 12)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
