Sobre

Esse projeto avalia o dataset sobre as hqs publicadas da marvel e visa fazer uma analise temporal de vendas por ano.

Carregando o dataset

O intuito aqui é definir o caminho do dataset e em seguida exibir as primeiras linhas dos dados

Limpeza e Transformação de Dados

Os dados foram tratados, convertendo datas e criando novas colunas, como o ano de lançamento:

# Verificar a coluna correta de data e ajustar o formato, se necessário
marvel_data <- marvel_data %>%
  mutate(release_date = dmy(publish_date)) # Ou ymd(), dependendo do formato
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `release_date = dmy(publish_date)`.
## Caused by warning:
## ! All formats failed to parse. No formats found.
# Criar uma nova coluna com o ano de lançamento
marvel_data <- marvel_data %>%
  mutate(year = year(release_date)) # Alterando para 'release_date'

# Exibir as primeiras linhas após a modificação
head(marvel_data)
##                                          comic_name active_years
## 1    A Year of Marvels: April Infinite Comic (2016)       (2016)
## 2   A Year of Marvels: August Infinite Comic (2016)       (2016)
## 3 A Year of Marvels: February Infinite Comic (2016)       (2016)
## 4     A Year of Marvels: July Infinite Comic (2016)       (2016)
## 5     A Year of Marvels: June Infinite Comic (2016)       (2016)
## 6    A Year of Marvels: March Infinite Comic (2016)       (2016)
##                                            issue_title      publish_date
## 1    A Year of Marvels: April Infinite Comic (2016) #1    April 01, 2016
## 2   A Year of Marvels: August Infinite Comic (2016) #1   August 10, 2016
## 3 A Year of Marvels: February Infinite Comic (2016) #1 February 10, 2016
## 4     A Year of Marvels: July Infinite Comic (2016) #1     June 29, 2016
## 5     A Year of Marvels: June Infinite Comic (2016) #1     June 15, 2016
## 6    A Year of Marvels: March Infinite Comic (2016) #1    March 09, 2016
##                                                                                                                                                                                                                                                                                                                                     issue_description
## 1                                                                                                                                                                                                                The Infinite Comic that will have everyone talking! Full of fun, heart, and pranks, this is one folks'll be talking about for years!
## 2                                                                                                                         It’s August, and Nick Fury is just in time to attend Japan’s Bon Festival…but he’s not here to celebrate. Not when an illegal weapons auction is about to begin! From Chad Bowers & Chris Sims (X-MEN ’92) and Brian Level!
## 3                                 Join us in a brand new Marvel comics adventure as your favorite heroes journey through the calendar year one month at a time! It’s February and Peter Parker’s got a hot date, but the old Parker luck hits hard…and so does the bank-robbing villain The Vulture! It’s a tale of romance, adventure, and punching!
## 4                                                                         Celebrating the Fourth of July is complicated enough for a patriotic symbol turned soviet assassin, but then Hydra agents had to go and rob the Winter Soldier’s secret storage locker. Who sent them? What do they want? Bucky doesn’t care — he just wants his #$%& back.
## 5 Sam Alexander’s finding it hard to cope with the fact that his dad is M.I.A. in the far reaches of space. Luckily, this Father’s Day, Nova’s got the chance to help former New Warrior Midnight’s Fire put his family back together. But when Iron Man shows up to inform his young teammate he’s backing the wrong horse, will Nova cool his jets?
## 6                                                        When business is down in March, Scott Lang’s Ant-Man Security Solutions will take just about any job offered to them- including stealing back stolen goods! But all is not as it seems! Join writer Amy Chu and artist Ryan Browne as they team together for this Spring Break themed heist!
##                    penciler                  writer   cover_artist
## 1              Yves Bigerel            Yves Bigerel Jamal Campbell
## 2            Jamal Campbell Chris Sims, Chad Bowers           None
## 3 Danilo S. Beyruth, M Mast              Ryan North           None
## 4            Juanan Ramirez            Chuck Wendig Jamal Campbell
## 5           Diego Olortegui              Paul Allor Jamal Campbell
## 6               Ryan Browne                 Amy Chu Jamal Campbell
##            Imprint          Format    Rating Price release_date year
## 1  Marvel Universe  Infinite Comic  Rated T+  Free         <NA>   NA
## 2  Marvel Universe  Infinite Comic      None  Free         <NA>   NA
## 3  Marvel Universe  Infinite Comic  Rated T+  Free         <NA>   NA
## 4  Marvel Universe  Infinite Comic      None  Free         <NA>   NA
## 5  Marvel Universe  Infinite Comic      None  Free         <NA>   NA
## 6  Marvel Universe  Infinite Comic      None  Free         <NA>   NA
# Verificar as primeiras linhas dos dados originais
head(marvel_data)
##                                          comic_name active_years
## 1    A Year of Marvels: April Infinite Comic (2016)       (2016)
## 2   A Year of Marvels: August Infinite Comic (2016)       (2016)
## 3 A Year of Marvels: February Infinite Comic (2016)       (2016)
## 4     A Year of Marvels: July Infinite Comic (2016)       (2016)
## 5     A Year of Marvels: June Infinite Comic (2016)       (2016)
## 6    A Year of Marvels: March Infinite Comic (2016)       (2016)
##                                            issue_title      publish_date
## 1    A Year of Marvels: April Infinite Comic (2016) #1    April 01, 2016
## 2   A Year of Marvels: August Infinite Comic (2016) #1   August 10, 2016
## 3 A Year of Marvels: February Infinite Comic (2016) #1 February 10, 2016
## 4     A Year of Marvels: July Infinite Comic (2016) #1     June 29, 2016
## 5     A Year of Marvels: June Infinite Comic (2016) #1     June 15, 2016
## 6    A Year of Marvels: March Infinite Comic (2016) #1    March 09, 2016
##                                                                                                                                                                                                                                                                                                                                     issue_description
## 1                                                                                                                                                                                                                The Infinite Comic that will have everyone talking! Full of fun, heart, and pranks, this is one folks'll be talking about for years!
## 2                                                                                                                         It’s August, and Nick Fury is just in time to attend Japan’s Bon Festival…but he’s not here to celebrate. Not when an illegal weapons auction is about to begin! From Chad Bowers & Chris Sims (X-MEN ’92) and Brian Level!
## 3                                 Join us in a brand new Marvel comics adventure as your favorite heroes journey through the calendar year one month at a time! It’s February and Peter Parker’s got a hot date, but the old Parker luck hits hard…and so does the bank-robbing villain The Vulture! It’s a tale of romance, adventure, and punching!
## 4                                                                         Celebrating the Fourth of July is complicated enough for a patriotic symbol turned soviet assassin, but then Hydra agents had to go and rob the Winter Soldier’s secret storage locker. Who sent them? What do they want? Bucky doesn’t care — he just wants his #$%& back.
## 5 Sam Alexander’s finding it hard to cope with the fact that his dad is M.I.A. in the far reaches of space. Luckily, this Father’s Day, Nova’s got the chance to help former New Warrior Midnight’s Fire put his family back together. But when Iron Man shows up to inform his young teammate he’s backing the wrong horse, will Nova cool his jets?
## 6                                                        When business is down in March, Scott Lang’s Ant-Man Security Solutions will take just about any job offered to them- including stealing back stolen goods! But all is not as it seems! Join writer Amy Chu and artist Ryan Browne as they team together for this Spring Break themed heist!
##                    penciler                  writer   cover_artist
## 1              Yves Bigerel            Yves Bigerel Jamal Campbell
## 2            Jamal Campbell Chris Sims, Chad Bowers           None
## 3 Danilo S. Beyruth, M Mast              Ryan North           None
## 4            Juanan Ramirez            Chuck Wendig Jamal Campbell
## 5           Diego Olortegui              Paul Allor Jamal Campbell
## 6               Ryan Browne                 Amy Chu Jamal Campbell
##            Imprint          Format    Rating Price release_date year
## 1  Marvel Universe  Infinite Comic  Rated T+  Free         <NA>   NA
## 2  Marvel Universe  Infinite Comic      None  Free         <NA>   NA
## 3  Marvel Universe  Infinite Comic  Rated T+  Free         <NA>   NA
## 4  Marvel Universe  Infinite Comic      None  Free         <NA>   NA
## 5  Marvel Universe  Infinite Comic      None  Free         <NA>   NA
## 6  Marvel Universe  Infinite Comic      None  Free         <NA>   NA

3. Gráfico de Publicações por Ano

neste bloco deveria ser mostrado um gráfico da quantidade de HQs publicadas por ano:

# Limpar a coluna 'year'
marvel_data$year <- gsub("\\(", "", marvel_data$year)  # Remove parênteses de abertura
marvel_data$year <- gsub("\\)", "", marvel_data$year)  # Remove parênteses de fechamento
marvel_data$year <- gsub("-", " ", marvel_data$year)   # Substitui hífen por espaço

# Converter a coluna 'year' para numérico
marvel_data$year <- as.numeric(marvel_data$year)

# Agrupar por ano e contar o número de HQs publicadas em cada ano
hqs_por_ano <- marvel_data %>%
  group_by(year) %>%
  summarise(total = n(), .groups = 'drop')

# Verificar resumo dos dados
summary(hqs_por_ano)
##       year         total      
##  Min.   : NA   Min.   :34992  
##  1st Qu.: NA   1st Qu.:34992  
##  Median : NA   Median :34992  
##  Mean   :NaN   Mean   :34992  
##  3rd Qu.: NA   3rd Qu.:34992  
##  Max.   : NA   Max.   :34992  
##  NA's   :1
# Verificar linhas com valores ausentes
any(is.na(hqs_por_ano))
## [1] TRUE
# Visualizar dados com possíveis problemas
hqs_por_ano[is.na(hqs_por_ano$year) | is.na(hqs_por_ano$total), ]
## # A tibble: 1 × 2
##    year total
##   <dbl> <int>
## 1    NA 34992
# Remover linhas com valores ausentes
hqs_por_ano_clean <- na.omit(hqs_por_ano)

# Verificar intervalo dos dados
range(hqs_por_ano_clean$year, na.rm = TRUE)
## Warning in min(x): nenhum argumento não faltante para min; retornando Inf
## Warning in max(x): nenhum argumento não faltante para max; retornando -Inf
## [1]  Inf -Inf
range(hqs_por_ano_clean$total, na.rm = TRUE)
## Warning in min(x): nenhum argumento não faltante para min; retornando Inf
## Warning in min(x): nenhum argumento não faltante para max; retornando -Inf
## [1]  Inf -Inf
# Gráfico de linhas com a contagem de HQs por ano
ggplot(hqs_por_ano_clean, aes(x = year, y = total)) +
  geom_line(color = "blue", linewidth = 1) +
  geom_point(color = "red") +
  labs(title = "Número de HQs da Marvel Publicadas por Ano",
       x = "Ano",
       y = "Número de HQs") +
  theme_minimal()

no entanto, por n fatores, não foi possivel exibir o grafico que mostrava o pico de vendas no decorrer dos anos, é possivel ver os erros acima