[R] using read.csv2()
Peter Dalgaard
pdalgd at gmail.com
Thu Sep 29 12:55:27 CEST 2016
> On 29 Sep 2016, at 11:40 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
>
> It's a "factor". read.csv2() defaults to a decimal separator of "," rather than ".", so the last column doesn't look like numbers, and they're being read as character strings, and then automatically converted to a factor. Reading as
>
Yep, that's the whole point of read.csv2 -- someone stupidly decided (back in the 90's) that the use of comma as a decimal separator in some languages should extend to storage file formats. That, of course, ruined the CSV standard use of comma as a field separator and prompted the double-standard situation where .csv files can be comma/period or semicolon/comma style, often depending on languages settings, which in turn can make data transfer between different languages an ungodly mess....
As Duncan points out, R provides settings that will (mostly) let you handle csv files that are written in hybrid formats like semicolon/period.
More information about the R-help
mailing list