Type: | Package |
Title: | Get Basic Information from Chinese ID Number |
Version: | 2.1.1 |
Maintainer: | Xinyuan Chu <chuxinyuan@outlook.com> |
Date: | 2025-04-11 17:01:48 UTC |
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. |
License: | MIT + file LICENSE |
URL: | https://github.com/chuxinyuan/cnid |
BugReports: | https://github.com/chuxinyuan/cnid/issues |
Depends: | R (≥ 3.5.0) |
RoxygenNote: | 7.3.2 |
Suggests: | testthat (≥ 2.1.0) |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2025-04-11 17:10:37 UTC; chuxinyuan |
Author: | Xinyuan Chu [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-04-11 17:20:02 UTC |
Get age information from ID number
Description
Get age information from ID number, to the day.
Usage
age(id)
Arguments
id |
A vector of ID numbers. |
Value
Age vector obtained from ID numbers.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
age(id)
Get age information from ID number
Description
Get age information from ID number, only by year, not the specific date.
Usage
age_by_year(id)
Arguments
id |
A vector of ID numbers. |
Value
Age vector obtained from ID numbers.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
age_by_year(id)
Get date of birth information from ID number
Description
Get date of birth information from ID number.
Usage
birth_date(id)
Arguments
id |
A vector of ID numbers. |
Value
Date of birth vector obtained from ID numbers.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
birth_date(id)
Check whether the ID number is valid
Description
Check whether the ID number is valid.
Usage
check_id(id)
Arguments
id |
A vector of ID numbers. |
Value
A vector of TRUE or FALSE.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
check_id(id)
Get full information from ID number
Description
Get full information from ID number.
Usage
cnid_info(id)
Arguments
id |
A vector of ID numbers. |
Value
A data frame about date of birth, age, gender, etc. obtained from ID number.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
cnid_info(id)
Convert the 15 Digits ID Number to 18 Digits
Description
Convert the 15 Digits ID Number to 18 Digits.
Usage
convert18(id)
Arguments
id |
A vector of ID numbers. |
Value
The corresponding 18 digits ID number.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
convert18(id)
Get constellation information from ID number
Description
Get constellation information from ID number.
Usage
cstl(id)
Arguments
id |
A vector of ID numbers. |
Value
Constellation vector obtained from ID numbers.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
cstl(id)
Get gender information from ID number
Description
Get gender information from ID number.
Usage
gender(id)
Arguments
id |
A vector of ID numbers. |
Value
Gender vector obtained from ID numbers.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
gender(id)
Calculate whether a given year is a leap year
Description
Calculate whether a given year is a leap year.
Usage
leap_year(year)
Arguments
year |
A given year, vectorization parameter passing is supported. |
Value
TRUE or FALSE. Return TRUE if it is a leap year, FALSE otherwise.
Examples
leap_year(2024)
Calculate the number of days in a given year and month
Description
Calculate the number of days in a given year and month.
Usage
mdays(year, month)
Arguments
year |
A given year. |
month |
A given month, vectorization parameter passing is supported. |
Value
Days in a given year and month.
Examples
mdays(2025, 1:12)
Get region information from ID number
Description
Get region information from ID number.
Usage
region(id)
Arguments
id |
A vector of ID numbers. |
Value
Region vector obtained from ID numbers.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
region(id)
Calculate the number of days in a given year
Description
Calculate the number of days in a given year.
Usage
ydays(year)
Arguments
year |
A given year, vectorization parameter passing is supported. |
Value
Days in a given year.
Examples
ydays(2025)
Get zodiac information from ID number
Description
Get zodiac information from ID number.
Usage
zodiac(id)
Arguments
id |
A vector of ID numbers. |
Value
Zodiac vector obtained from ID numbers.
Examples
id = c(
"653127198503161793",
"652801197305161555",
"130206202202291545",
"110101841125178",
"12345678",
"65312a198204181793"
)
zodiac(id)