Este é um documento R Markdown. Markdown é uma sintaxe de formatação simples para criação de documentos HTML, PDF e MS Word. Para obter mais detalhes sobre o uso do R Markdown, consulte http://rmarkdown.rstudio.com.
Quando você clica no botão Knit, será gerado um documento que inclui tanto o conteúdo quanto a saÃda de quaisquer pedaços de código R incorporados no documento. Você pode incorporar um pedaço de código R como este:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
Você também pode incorporar gráficos, por exemplo:
Observe que o parâmetro echo = FALSE foi adicionado ao
bloco de código para evitar a impressão do código R que gerou o
gráfico.
fazendo teste
#Rio de janeiro 15 de novembro de 2024 #teste em casa
#imagem
#
#teste ok
library (ggplot2)
library(zoo)
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(data.table)
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:zoo':
##
## yearmon, yearqtr
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(naivebayes)
## naivebayes 1.0.0 loaded
## For more information please visit:
## https://majkamichal.github.io/naivebayes/
##
## Attaching package: 'naivebayes'
## The following object is masked from 'package:data.table':
##
## tables
library(neuralnet)
##
## Attaching package: 'neuralnet'
## The following object is masked from 'package:dplyr':
##
## compute
library(quantmod)
## Loading required package: xts
##
## ######################### Warning from 'xts' package ##########################
## # #
## # The dplyr lag() function breaks how base R's lag() function is supposed to #
## # work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or #
## # source() into this session won't work correctly. #
## # #
## # Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
## # conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop #
## # dplyr from breaking base R's lag() function. #
## # #
## # Code in packages is not affected. It's protected by R's namespace mechanism #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning. #
## # #
## ###############################################################################
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
## The following objects are masked from 'package:data.table':
##
## first, last
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(fpp)
## Loading required package: forecast
## Loading required package: fma
## Loading required package: expsmooth
## Loading required package: lmtest
## Loading required package: tseries
library(fpp2)
##
## Attaching package: 'fpp2'
## The following objects are masked from 'package:fpp':
##
## ausair, ausbeer, austa, austourists, debitcards, departures,
## elecequip, euretail, guinearice, oil, sunspotarea, usmelec
library(forecast)
library(DMwR2)
##
## Attaching package: 'DMwR2'
## The following object is masked from 'package:fma':
##
## sales
library(stats)
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
#Ler os arquivos das planilhas Excel.
library(readxl)
Salario_base2024 <- read_excel("Salario_base2024.xlsx")
library(readxl)
Vendas2024 <- read_excel("Vendas2024.xlsx")
vendas <- read_excel("Vendas2024.xlsx")
salario_base <- read_excel("Salario_base2024.xlsx")
venda_mes <- vendas %>%
group_by(ano ,mes) %>%
summarise(venda_mensal = sum(venda_diaria)) %>%
arrange(ano, mes)
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
plot(venda_mes$venda_mensal)
vendas_mes_ts <- ts(venda_mes$venda_mensal, start = c(2018,1), frequency = 12)
plot(vendas_mes_ts)
decomp_vendas_mes <- decompose(vendas_mes_ts, type = 'additive')
plot(decomp_vendas_mes)
forecast(vendas_mes_ts , 6, 90)
## Point Forecast Lo 90 Hi 90
## Apr 2024 592128.1 508364.8 675891.4
## May 2024 677756.0 563531.7 791980.3
## Jun 2024 626941.9 488818.4 765065.3
## Jul 2024 546903.3 388445.2 705361.4
## Aug 2024 546792.1 370327.1 723257.0
## Sep 2024 543842.9 351045.7 736640.1