library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(glue)
##
## Attaching package: 'glue'
## The following object is masked from 'package:dplyr':
##
## collapse
fix_dates <-trees %>%
mutate(Date = mdy(Date)) %>%
mutate(Date=year(Date)) %>%
count(Date)
fix_dates
## # A tibble: 10 x 2
## Date n
## <dbl> <int>
## 1 2014 1060
## 2 2015 1721
## 3 2016 1929
## 4 2017 1960
## 5 2018 2116
## 6 2019 2978
## 7 2020 4239
## 8 2021 3919
## 9 2022 360
## 10 2023 1820
trees %>%
select(Sales_Price) %>%
count(Sales_Price) %>%
arrange(desc(n))
## # A tibble: 2,788 x 2
## Sales_Price n
## <chr> <int>
## 1 35 2807
## 2 85 496
## 3 375 457
## 4 175 375
## 5 325 349
## 6 0 325
## 7 395 317
## 8 475 292
## 9 425 289
## 10 495 276
## # … with 2,778 more rows
count_dates <- trees %>%
count(Date) %>%
arrange(desc(Date))
count_dates
## # A tibble: 1,948 x 2
## Date n
## <chr> <int>
## 1 9/9/2023 3
## 2 9/9/2021 7
## 3 9/9/2020 4
## 4 9/9/2019 12
## 5 9/9/2018 2
## 6 9/9/2017 13
## 7 9/9/2016 7
## 8 9/9/2015 20
## 9 9/9/2014 7
## 10 9/8/2023 7
## # … with 1,938 more rows
fixplz<- fix_dates%>%
ggplot(aes(x=Date ,y=n, group =10))+
geom_line()
fix_dates %>%
# mutate(Date = mdy(Date)) %>%
# mutate(Date=year(Date)) %>%
ggplot(aes(x=Date ,y=n, group =10))+
geom_line()

# View(count_dates)
count_dates %>%
ggplot(aes(x = Date, y = n, group = 100 )) +
geom_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
