From msuzen at mango-solutions.com  Wed Sep 28 01:23:53 2011
From: msuzen at mango-solutions.com (Mehmet Suzen)
Date: Wed, 28 Sep 2011 00:23:53 +0100
Subject: [Rd] read.csv behaviour
Message-ID: <3CBFCFB1FEFFA841BA83ADF2F2A9C6FA01AB2673@mango-data1.Mango.local>


This might be obvious but I was wondering if anyone knows quick and easy
way of writing out a CSV file with varying row lengths, ideally an
initial data read from a CSV file which has the same format. See example
below.


I found it quite strange that R cannot write it in one go, so one must
append blocks or post-process the file, is this true? (even Ruby can do
it!!) 

Otherwise it puts ,"","" or similar for missing column values in the
shorter length rows and fill=FALSE option do not work!

I don't want to post-process if possible.

See this post:
http://r.789695.n4.nabble.com/Re-read-csv-trap-td3301924.html

Example that generated Error!

writeLines(c("A,B,C,D",
             "1,a,b,c",
             "2,f,g,c",
             "3,a,i,j",
             "4,a,b,c",
             "5,d,e,f",
             "6,g,h,i,j,k,l,m,n"),
           con=file("test.csv"))

read.csv("test.csv")
try(read.csv("test.csv",fill=FALSE))
LEGAL NOTICE
This message is intended for the use o...{{dropped:10}}



[Rd] read.csv behaviour
Mehmet Suzen