[R] Reading a file in R

David Barron mothsailor at googlemail.com
Tue Sep 19 12:32:44 CEST 2006


I think that command should work (assuming that it is *comma* rather
than semi-colon delimited, which is used in countries where a comma is
used as a decimal point, in which case you should use read.csv2
instead).  So,  is your data definitely as clean as you think. Have
you looked at the data in a text editor?  What are the dimensions of
the resulting data frame?

On 19/09/06, Mesomeris, Spyros [CIR] <spyros.mesomeris at citigroup.com> wrote:
> Dear R helpers,
>
> I am trying to read a CSV file in R called EUROPE (originally an Excel
> file which I have saved as a CSV file) using the command
>
> EUROPEDATA <- read.csv("EUROPE.csv")
>
> EUROPE.csv is basically a matrix of dimension 440*44, and has a line of
> headers, i.e. each column has a name.
>
> Using read.csv I can't load the data into R properly. Although the first
> 20 columns or so are read in properly, some of the data from the
> remaining columns are missing, eg. For Column 29, the loaded file cannot
> read the first 120 observations and puts NA in their place, whereas the
> rest of the column is read in properly! I find this really strange.
>
> I have tried to use read.table and scan commands as well, with the
> header = T option, but still the problem is not solved. Please note the
> columns are formatted in the same way, and contain numbers (apart form
> the header row).
>
> Does anybody have any idea how I can read the data properly into R?
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
=================================
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP



More information about the R-help mailing list