chartodec: Convert a vector from character to decimal numbers
Description
A vector of numbers encoded as character strings without a decimal point is converted to numbers with a decimal point in a given position
Usage
chartodec(cvec, ndec)
Value
A vector of numerical values with a decimal point inserted as per argument ndec
Arguments
cvec
A vector of type character.
ndec
An integer giving the number of digits to follow the implied decimal point
Author
Neville Jackson
Details
It is a common problem when reading a table of fixed width formatted data into a dataframe using function read.fwf() for the dataframe columns to end up of type character with no decimal point. If these columns are actually meant to be decimal numbers with an implied decimal point in a fixed position, they can be converted to numeric with this function.