CAS.checksum: Test the check digit of a CAS number to confirm validity

View source: R/add_chemtable.R

CAS.checksumR Documentation

Test the check digit of a CAS number to confirm validity

Description

Chemical abstracts services registry numbers (CAS-RN) include a final digit as a "checksum" to test for validity (that is, that the number has not been corrupted).

Usage

CAS.checksum(CAS.string)

Arguments

CAS.string

A character string of three numbers separated by two dashes

Details

The check digit (final number) is calculated by working from right to left, starting with the second to last digit of the CAS-RN. We multiply each digit by an increasing digit (1, 2, 3...) and sum as we work from right to left. The check digit should equal the final digit of the sum.

Value

logical (TRUE if final digit of CAS is consistent with other digits)

Author(s)

John Wambaugh


httk documentation built on Sept. 11, 2024, 9:32 p.m.