library(lotterybr)
library(ggplot2)
In this vignette we are going to see an example of the usage of this package first, let’s start by loading in the package
library(lotterybr)
library(ggplot2)
Let’s suppose that we want to see the data of numbers of the game megasena in portuguese, therefore we can do
= get_data(game = "megasena", type = "numbers", language = "ptbr")
megasena_numbers head(megasena_numbers)
# A tibble: 6 × 4
data concurso acumula dezenas
<date> <int> <chr> <fct>
1 1996-03-11 1 sim 04
2 1996-03-11 1 sim 05
3 1996-03-11 1 sim 30
4 1996-03-11 1 sim 33
5 1996-03-11 1 sim 41
6 1996-03-11 1 sim 52
Or, if we want to see the winners of lotofacil in portuguese
= get_data(game = "lotofacil", type = "winners", language = "eng")
lotofacil_winners head(lotofacil_winners)
# A tibble: 6 × 6
date course accumulated match winners prize
<date> <int> <chr> <chr> <int> <dbl>
1 2003-09-29 1 no 15 5 49766.
2 2003-09-29 1 no 14 154 690.
3 2003-09-29 1 no 13 4645 10
4 2003-09-29 1 no 12 48807 4
5 2003-09-29 1 no 11 257593 2
6 2003-10-06 2 no 15 1 596324.
We can use this data to create plots
ggplot(lotofacil_winners, aes(x = factor(match), y = winners, fill = match)) +
geom_bar(stat = "identity", position = "dodge") +
labs(x = "Match", y = "Winners frequency", title = "Winners by Match") +
theme_minimal()
or to analyse the data:
= data.frame(
df dezenas =summary(
$dezenas
megasena_numbers
)
)summary(df$dezenas)
Min. 1st Qu. Median Mean 3rd Qu. Max.
244.0 283.0 296.0 296.3 312.0 353.0
head(df)
dezenas
01 282
02 292
03 277
04 309
05 318
06 300