Package 'CNID'

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.0
Built: 2025-03-17 19:24:22 UTC
Source: https://gitlab.com/chuxinyuan/cnid

Help Index


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)