[R] Problem reading mixed CSV file

jim holtman jholtman at gmail.com
Fri Mar 16 17:21:37 CET 2012


What do you mean by Mixed?  If a field has a comma, then it is
supposed be to enclosed in quotes.  You could preprocess the file
looking for cases where there are more fields than there there are
supposed to be, and if they are always in the same place, you could
enclose them in quotes and then reprocess.  You would really have to
show what the file looks like for the different "mixed" cases to get a
good answer to your question.  And of course, R can do it, if we knew
what it was we are supposed to do.

So at least  provide commented, minimal, self-contained, reproducible
code and data.

On Fri, Mar 16, 2012 at 7:03 AM, Ashish Agarwal
<ashish.agarwala at gmail.com> wrote:
> I am having trouble reading this CSV file in R. There are six attributes
> that I need to read  - CVar1, CVar2, Location, Year, Nvar3, Nvar4. Can
> somebody help in reading this file?
> On line 10 it has city and state separated by comma. I had been a user of
> SAS where I can use different format to read in for this line. Can I do
> this in R too?
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.



More information about the R-help mailing list