R Markdown
library(readr)
## Warning: replacing previous import 'lifecycle::last_warnings' by
## 'rlang::last_warnings' when loading 'tibble'
## Warning: replacing previous import 'ellipsis::check_dots_unnamed' by
## 'rlang::check_dots_unnamed' when loading 'tibble'
## Warning: replacing previous import 'ellipsis::check_dots_used' by
## 'rlang::check_dots_used' when loading 'tibble'
## Warning: replacing previous import 'ellipsis::check_dots_empty' by
## 'rlang::check_dots_empty' when loading 'tibble'
## Warning: replacing previous import 'lifecycle::last_warnings' by
## 'rlang::last_warnings' when loading 'pillar'
## Warning: replacing previous import 'ellipsis::check_dots_unnamed' by
## 'rlang::check_dots_unnamed' when loading 'pillar'
## Warning: replacing previous import 'ellipsis::check_dots_used' by
## 'rlang::check_dots_used' when loading 'pillar'
## Warning: replacing previous import 'ellipsis::check_dots_empty' by
## 'rlang::check_dots_empty' when loading 'pillar'
cleanedtreesdf2_1_ <- read_csv("cleanedtreesdf2 (1).csv")
## Warning: Missing column names filled in: 'X1' [1]
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## X1 = col_double(),
## Type = col_character(),
## Date = col_character(),
## Num = col_character(),
## Ship_To_Address2 = col_character(),
## Ship_Zip = col_character(),
## Item = col_character(),
## Qty = col_double(),
## Sales_Price = col_character(),
## Amount = col_double()
## )
#View(cleanedtreesdf2_1_)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2 ✓ dplyr 1.0.2
## ✓ tibble 3.0.4 ✓ stringr 1.4.0
## ✓ tidyr 1.1.2 ✓ forcats 0.5.0
## ✓ purrr 0.3.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
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
cleanedtreesdf2_1_ -> TREE
TREE <- TREE %>%
mutate(Date = mdy(Date)) %>%
mutate(Sales_Price = as.numeric(Sales_Price))
## Warning: Problem with `mutate()` input `Sales_Price`.
## i NAs introduced by coercion
## i Input `Sales_Price` is `as.numeric(Sales_Price)`.
## Warning in mask$eval_all_mutate(dots[[i]]): NAs introduced by coercion
#View(TREE)
TREE %>%
ggplot(aes(x = Date, y = Qty, group = 1, colour = Amount)) +
geom_line() +
labs(title = "Number Of Sales Each Day",
subtitle = "date and quantity",
x = "date sold", Y = "Number of Items Sold",
colour = "date")

TREE
## # A tibble: 22,102 x 10
## X1 Type Date Num Ship_To_Address2 Ship_Zip Item Qty
## <dbl> <chr> <date> <chr> <chr> <chr> <chr> <dbl>
## 1 1 Invo… 2023-07-29 9845 MacTavish Court 46703 "Tre… 2
## 2 2 Invo… 2023-07-29 9845 MacTavish Court 46703 "Tri… 1
## 3 3 Invo… 2023-05-11 SI-1… McDarmid Ave 46703 "Tre… 4
## 4 4 Invo… 2023-05-11 SI-1… McDarmid Ave 46703 "Rep… NA
## 5 5 Invo… 2023-07-11 SI-1… McDarmid Ave 46703 "Tre… 1
## 6 6 Invo… 2023-07-11 SI-1… McDarmid Ave 46703 "Rep… NA
## 7 7 Invo… 2023-04-12 7662R Menza Drive 46706 "Tre… 1
## 8 8 Invo… 2023-04-12 7662R Menza Drive 46706 "Rep… NA
## 9 9 Invo… 2023-05-19 8378R Cascina Lane 46706 "Tre… 1
## 10 10 Invo… 2023-05-19 8378R Cascina Lane 46706 "Rep… NA
## # … with 22,092 more rows, and 2 more variables: Sales_Price <dbl>,
## # Amount <dbl>
LOSS <- TREE%>%
filter(
Sales_Price <= 0
)
loss <-LOSS%>%
filter(Sales_Price >= -3000)
loss%>%
ggplot(aes(x = Date, y = Sales_Price, group = 1, colour = Amount)) +
geom_line() +
labs(title = "Number Of Sales Each Day",
subtitle = "date and quantity",
x = "date sold", Y = "Number of Items Sold",
colour = "date")

LOSS%>%
ggplot( aes(x = Sales_Price)) +
geom_density()

LOSS%>%
ggplot(aes(y = Date, x = Sales_Price)) +
geom_point()
