setwd("C:/Users/felix/OneDrive/Escritorio/parcialinf2")
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.1.3
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.6 v dplyr 1.0.8
## v tidyr 1.2.0 v stringr 1.4.0
## v readr 2.1.2 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(data.table)
## Warning: package 'data.table' was built under R version 4.1.3
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
##
## between, first, last
## The following object is masked from 'package:purrr':
##
## transpose
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:data.table':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week,
## yday, year
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(ggrepel)
## Warning: package 'ggrepel' was built under R version 4.1.3
library(scales)
##
## Attaching package: 'scales'
## The following object is masked from 'package:purrr':
##
## discard
## The following object is masked from 'package:readr':
##
## col_factor
library(hrbrthemes)
## Warning: package 'hrbrthemes' was built under R version 4.1.3
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
## Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
## if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
library(ggplot2)
##Juan Alfaro
data <- fread("superstore.csv")
aux1 <- data %>%
mutate(FecOrden = as.Date(FecOrden, "%d/%m/%Y"),
FecEnvio = as.Date(FecEnvio, "%d/%m/%Y"),
FechaOrden= floor_date(FecOrden, unit = "month")
) %>%
group_by(FechaOrden, Segmento, Categoria, Prioridad) %>%
summarise(TotVentas = sum(Venta))
## `summarise()` has grouped output by 'FechaOrden', 'Segmento', 'Categoria'. You
## can override using the `.groups` argument.
ggplot(aux1, aes(x=FechaOrden, y=TotVentas, colour = Segmento )) +
geom_line() +
hrbrthemes::theme_ft_rc()+
labs(title="Histórico de Ventas",
subtitle="Segregación Por Categoria y Prioridad",
colour = "Segmento de Cliente")+
facet_grid(Categoria~Prioridad,scales='free_x', space='free_x')+
geom_label_repel(aes ( label = TotVentas))+
scale_color_hue(labels = c("Consumidor", "Corporativo","Home Ofice"))+
theme(legend.position = "bottom")+
geom_smooth()+
theme(legend.text = element_text(color = "steelblue", size = 8))+
theme(axis.title=element_text(size=10,face="bold"))+
theme(axis.text.y = element_text(colour = "steelblue",size=8,face = "bold"))+
theme(axis.text.x = element_text(colour = "steelblue",size=8,face = "bold"))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning: ggrepel: 133 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 144 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 137 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 144 unlabeled data points (too many overlaps). Consider increasing max.overlaps
## ggrepel: 144 unlabeled data points (too many overlaps). Consider increasing max.overlaps
## ggrepel: 144 unlabeled data points (too many overlaps). Consider increasing max.overlaps
## Warning: ggrepel: 128 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 139 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 123 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 144 unlabeled data points (too many overlaps). Consider increasing max.overlaps
## ggrepel: 144 unlabeled data points (too many overlaps). Consider increasing max.overlaps
## ggrepel: 144 unlabeled data points (too many overlaps). Consider increasing max.overlaps
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
