How to convert Japanese Calendar Years with Nengo (年号) to Common Era

Let’s say you have a data frame with Japanese Calendar Years with Nengo like this.

If you want to convert them into Common Era, you can make use of mutate with case_when function like this.

case_when(
 nengo == "昭和" ~ year + 1925,
 nengo == "平成" ~ year + 1988,
 TRUE ~ 0)

It would look like this on the mutate dialog.

Here is the resulting data frame with a new column with the years in Common Era.