extract.digits function

Extracts the leading digits from the data