It appears that read.csv() converts floats to factors if they have a large number of decimal places.
test_works.csv
:
a,b
1.255,2.993
1.834,2.555
test_fails.csv
:
a,b
1.2555555555555555555555,2.993
1.834,2.555
> str(read.csv("test_works.csv"))
'data.frame': 2 obs. of 2 variables:
$ a: num 1.25 1.83
$ b: num 2.99 2.56
> str(read.csv("test_fails.csv"))
'data.frame': 2 obs. of 2 variables:
$ a: Factor w/ 2 levels "1.2555555555555555555555",..: 1 2
$ b: num 2.99 2.56
Also, this is new behavior and there is some debate over whether it should remain this way or change back:
http://r.789695.n4.nabble.com/type-convert-and-doubles-td4688616.html