Skip to content
Prev 293274 / 398502 Next

Numeric data not numeric in .csv file

On 05/02/2012 10:47 AM, Eve Proper wrote:
Hi Eve,
Have you tried "as.numeric" on them? As Jeff suggested, you may be 
importing spaces along with the digits or some other character that 
changes the class of the variable. Also note that the default behavior 
of functions like read.csv is to coerce all of the values in a column of 
the resulting data frame to the "lowest common denominator". If you have 
one text value in a column of numbers, you usually get factor values. 
This is due to the restriction that all values in a column must be of 
the same class (data type).

Jim