| Title: | Get Basic Information from Chinese ID Number |
|---|---|
| Description: | The Chinese ID number contains a lot of information, this package helps you get the region, date of birth, age, age based on year, gender, zodiac, constellation information from the Chinese ID number. |
| Authors: | Xinyuan Chu [aut, cre] |
| Maintainer: | Xinyuan Chu <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 2.1.1 |
| Built: | 2026-05-10 07:23:54 UTC |
| Source: | https://github.com/chuxinyuan/cnid |
Get age information from ID number, to the day.
age(id)age(id)
id |
A vector of ID numbers. |
Age vector obtained from ID numbers.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) age(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) age(id)
Get age information from ID number, only by year, not the specific date.
age_by_year(id)age_by_year(id)
id |
A vector of ID numbers. |
Age vector obtained from ID numbers.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) age_by_year(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) age_by_year(id)
Get date of birth information from ID number.
birth_date(id)birth_date(id)
id |
A vector of ID numbers. |
Date of birth vector obtained from ID numbers.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) birth_date(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) birth_date(id)
Check whether the ID number is valid.
check_id(id)check_id(id)
id |
A vector of ID numbers. |
A vector of TRUE or FALSE.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) check_id(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) check_id(id)
Get full information from ID number.
cnid_info(id)cnid_info(id)
id |
A vector of ID numbers. |
A data frame about date of birth, age, gender, etc. obtained from ID number.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) cnid_info(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) cnid_info(id)
Convert the 15 Digits ID Number to 18 Digits.
convert18(id)convert18(id)
id |
A vector of ID numbers. |
The corresponding 18 digits ID number.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) convert18(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) convert18(id)
Get constellation information from ID number.
cstl(id)cstl(id)
id |
A vector of ID numbers. |
Constellation vector obtained from ID numbers.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) cstl(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) cstl(id)
Get gender information from ID number.
gender(id)gender(id)
id |
A vector of ID numbers. |
Gender vector obtained from ID numbers.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) gender(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) gender(id)
Calculate whether a given year is a leap year.
leap_year(year)leap_year(year)
year |
A given year, vectorization parameter passing is supported. |
TRUE or FALSE. Return TRUE if it is a leap year, FALSE otherwise.
leap_year(2024)leap_year(2024)
Calculate the number of days in a given year and month.
mdays(year, month)mdays(year, month)
year |
A given year. |
month |
A given month, vectorization parameter passing is supported. |
Days in a given year and month.
mdays(2025, 1:12)mdays(2025, 1:12)
Get region information from ID number.
region(id)region(id)
id |
A vector of ID numbers. |
Region vector obtained from ID numbers.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) region(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) region(id)
Calculate the number of days in a given year.
ydays(year)ydays(year)
year |
A given year, vectorization parameter passing is supported. |
Days in a given year.
ydays(2025)ydays(2025)
Get zodiac information from ID number.
zodiac(id)zodiac(id)
id |
A vector of ID numbers. |
Zodiac vector obtained from ID numbers.
id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) zodiac(id)id = c( "653127198503161793", "652801197305161555", "130206202202291545", "110101841125178", "12345678", "65312a198204181793" ) zodiac(id)