[R] importing files, columns "invade next column"

Marc Schwartz MSchwartz at MedAnalytics.com
Thu Jan 20 02:54:05 CET 2005


On Thu, 2005-01-20 at 01:12 +0000, Tiago R Magalhaes wrote:
> Thanks again Marc for your help.

Happy to help.

> At this point I already have the whole file as a data.frame in R (via 
> Splus dump and then R source) so my problem for this specific problem 
> is solved.
> 
> I had changed my file in Excel and thought everything was fine but 
> apparently it wasn't.

I think that this is the source of the problem. Excel has known problems
when generating an ASCII delimited export file, especially when there
are blank cells. It can result in an inconsistent number of columns
being exported, which is in turn consistent with what you are
experiencing here. 

>  What program is used to display a tab file 
> separated in columns that doesn't corrupt the data?

There are a variety of them, from data editors to simple file viewing
programs to data format conversion programs. 

Some good (free) options are referenced in Chapter 8 of the R Data
Import/Export manual. These generally include avoiding the export step
and reading the data in the Excel file directly or for example, using
OO.org's Calc spreadsheet application, which does not have the same
problem with the export process.

HTH,

Marc




More information about the R-help mailing list