Add a `dec` option that sets the decimal
In Germany we write decimal values like 12,34 rather than like 12.34. It would be nice to be able to tell the number conversion code that this is the case.
This is a useful feature of the R CSV reader, but upon further consideration it might not make sense here. @ngrunwald What do you think?
Have you an example file where this is not working? Because it should, at least from the reading side (but maybe not tested often). But I think the parameter would be very useful for the writing side, to allow to round-trip data. I would think this would be a parameter at the file level and not the field level, I don't remember ever encountering files with this kind of mixed formating, what do you think?
You're absolutely right. What I'm seeing is a situation where German numbers come in formatted like:
{:bundesland "Baden-Württemberg",
:cases "2.155",
:difference-carried-forward "+546",
:cases-per-100k "19,47",
:deaths "6",
:particularly-affected-areas nil}
... and the output of meta-csv is like:
{:bundesland "Baden-Württemberg",
:cases 2.155,
:difference-carried-forward "+546",
:cases-per-100k 19.47,
:deaths 6,
:particularly-affected-areas nil}
It's accepting both , and . as decimals, even though the . is marking thousands in these numbers. This is, of course, the opposite of the English method.
It feels like it might be right to fail if there are two different kinds of decimal marker in the same number? Or, as I considered and rejected with the previous issue, a way to pass a thousands mark...?