-
Notifications
You must be signed in to change notification settings - Fork 0
/
04-data-cumulative-pokemon-count-data.Rmd
37 lines (32 loc) · 1.63 KB
/
04-data-cumulative-pokemon-count-data.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# game release dates and generation, cumulative pokemon data
```{r}
df_game_gen <-
tribble(
~game_gen, ~game_release_date, ~game_release_date_ja, ~pokemon_n_new,
1, "1998-09-28", "1996-02-27", 151,
2, "2000-10-15", "1999-11-21", 100,
3, "2003-03-15", "2002-11-21", 135, # https://bulbapedia.bulbagarden.net/wiki/Generation_III
4, "2007-04-22", "2006-09-28", 107, # https://bulbapedia.bulbagarden.net/wiki/Generation_IV
5, "2011-03-04", "2010-09-18", 156,
6, "2013-10-12", "2013-10-12", 72,
7, "2016-11-18", "2016-11-18", 88, # 81+5+2=88
8, "2019-11-15", "2019-11-15", 96, # 89+7
9, "2022-11-18", "2022-11-18", NA_integer_
) |>
mutate(
across(starts_with("game_release"), as.Date),
game_end_date = lead(game_release_date),
pokemon_cumulative_n = cumsum(pokemon_n_new)
)
df_game_gen
```
これをもとに、各リリースがどのGenerationまでのポケモンを使えたのかを書いておきたい(temporal_change_each_release_dfをプロットする際にgenerationでfacet gridしたいため)。
game_release_dateとgame_end_dateに挟まれてるrelease_dateのgame_genを書きたいだけなんだ!!どうやる!!
できたけどrelease_dateがからっぽな日本リリースは除かれるよ。問題ないと思うけど。
→series_genを使ってね
```{r}
df_series3 <-
full_join(df_series2, df_game_gen, by = character()) |>
filter(release_date > game_release_date & release_date < game_end_date) |>
select(all_of(df_series2 |> colnames()), release_gen = game_gen)
```