sdcTools / sdcMicro

sdcMicro
http://sdctools.github.io/sdcMicro/
79 stars 23 forks source link

Adding default comment.char parameter for csv imports #297

Closed leebrian closed 4 years ago

leebrian commented 4 years ago

Perceived Problem

Read.table has a set of default parameters for csv files under the read.csv function. This includes setting comment.char to "" instead of read.table's default "#".

Your sdcApp gui doesn't set comment.char to "" so if I try to read in a csv with an unescaped hash, the GUI errors.

Rationale for change

I propose this change so the sdcMicro import behavior for csv follows read.csv's default parameters. I think this will make debugging easier as the GUI behaves like read.csv.

Steps to reproduce

this csv file will error on record one

foo,bar
#hello,world
hello,world

this csv will pass with two records

foo,bar
hello,world
hello,world

this csv will pass with two records

foo,bar
"#hello",world
hello,world

Workaround

This isn't a blocker as I'm just reading my csv directly using read.csv and not using the sdcApp gui's CSV import, but this may be confusing to others wondering why read.csv parses their CSV file, but sdcApp doesnt.

Great package by the way, it's been so helpful.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.004%) to 30.649% when pulling 3f9e7c55804716667c16329716502e00201d624c on leebrian:guifunctions_csv_params_fix into 826950711e7cad4afc0cab8b1e29bcf0a55df9f0 on sdcTools:master.

bernhard-da commented 4 years ago

hi @leebrian thx for reporting this and providing a pull-request! i think this is indeed a useful change and thus i will merge it right away.