The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
English version of README is not available for now.
jcalendaR
はRで和暦と旧暦、西暦(ユリウス暦、(先発)グレゴリウス暦)の年月日を相互変換を行うためのパッケージです。
和暦から西暦(ユリウス暦、(先発)グレゴリウス暦)への変換ができます。
旧暦から西暦(ユリウス暦、(先発)グレゴリウス暦)への変換ができます。
西暦(ユリウス暦、(先発)グレゴリウス暦)から和暦への変換ができます。
西暦(ユリウス暦、(先発)グレゴリウス暦)から旧暦への変換ができます。
年号を付与しない場合は旧暦は1年1月1日(先発グレゴリオ暦1年2月10日)から2100年12月1日(グレゴリウス暦2100年12月31日)までしか対応していません。
年号は、景行天皇以降(旧暦17年以降)の元号に対応してています。
旧暦の閏月は「閏」と「うるう」の両方の表記をサポートします。
改元の最初の年は「元年」と「1年」の両方の表記をサポートします。
和暦と旧暦は明治5年以前は一致します。
旧暦の暦法および、元号の表記および改元日は参照元データによるものです。
内部的に、ユリウス通日を計算しています。
西暦から(修正)ユリウス通日、(修正)ユリウス通日から西暦へ変換する関数もあります。
リリース版はCRANからインストールできます。
install.package("jcalendaR")
開発版はGithubからインストールできます。
::install_github("indenkun/jcalendaR") remotes
library(jcalendaR)
wareki2seireki("令和3年1月1日")
#> [1] "2021/1/1"
seireki2wareki("2021/1/1")
#> [1] "令和3年1月1日"
wareki2seireki("天正6年3月13日", calendar = "julian")
#> [1] "1578/4/19"
seireki2wareki("1578/4/18")
#> [1] "天正6年3月2日"
kyureki2seireki("令和3年1月1日")
#> [1] "2021/2/12"
seireki2kyureki("2021/1/1")
#> [1] "令和2年11月18日"
wareki2kyureki("令和3年1月1日")
#> [1] "令和2年11月18日"
kyureki2wareki("令和2年11月18日")
#> [1] "令和3年1月1日"
旧暦の指定した年に閏月があるかどうか、理論型か閏月の値で答えます。
指定する年の値は年号と数字で構成される必要があります。数字の後ろに年がついているかどうかは問いません。
existence_leap.month("明治2")
#> [1] FALSE
existence_leap.month("明治2", existence = "number")
#> [1] NA
existence_leap.month("明治3年", existence = "logical")
#> [1] TRUE
existence_leap.month("明治3年", existence = "number")
#> [1] 10
旧暦の指定した年の指定した月が何日あるか。閏月を指定した場合、その年に閏月がないならその旨を警告文で出します。
指定する年の値は年号と数字で構成される必要があります。数字の後ろに年がついているかどうかは問いません。
また、指定する月は数値または文字列で、文字列の場合に数字の後ろに月がついているかどうかは問いません。
number_kyureki.month("明治2", 1)
#> [1] 30
number_kyureki.month("明治2年", "閏1")
#> Warning: There are no leap months in that year.
#> [1] NA
number_kyureki.month("明治3", "閏10月")
#> [1] 29
jdn2calendar(2459216)
#> [1] "2021/1/1"
calendar2jdn("2021/1/1")
#> [1] 2459216
seireki2wareki("1/1/1")
#> Warning: Entered a date older than the supported period.
#> [1] NA
wareki2seireki("天保2年2月30日")
#> Warning: The number of days entered does not exist for the month.
#> [1] NA
wareki2seireki("0年1月1日", era = "non")
#> Warning: Entered a date older than the supported period.
#> [1] NA
kyureki2seireki("2101年1月1日", era = "non")
#> Warning: Entered a date that is farther in the future than the supported dates.
#> [1] NA
ユリウス通日の計算にはユリウス通日 - Wikipediaの式を用いています。
グレゴリウス暦と旧暦の対照表、元号について以下のデータを参照しました。
MIT
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.