[R] Reading large data matrix in R

David Winsemius dwinsemius at comcast.net
Fri Jan 9 23:23:45 CET 2015

On Jan 9, 2015, at 6:44 AM, Madhavan BL wrote:

> Dear All,
> Greetings. I am a new user of R programming.
> I have a large ASCII data file with 14 columns and 45000 rows. I tried to
> load the file using read.table(), scan(), etc. functions, but failed to
> load the data file properly. Missing values in my data are denoted by
> "NaN". I also want to exclude these lines. I don't have a column header but
> I would like to include the labels in plotting.

What these "labels" you are referring to?

> All the data is in floats.
> Can anyone give me some short examples to open my file?

The default settings for `read.table` assume that there is no header row and that `NA` is the missing value indicator. See ?read.table for more on the default settings. If you have `NaN` as missing value you need to include an na.strings="NaN" argument in the `read.table` call. 

You would need to post process results to exclude rows. There is no interval skipping mechanism that I know about.

`scan` assumes all lines have the same structure so answering the question about "labels" would be necessary for any advice about its use here.

> Look forward for your support,
> Thanking you in advance,
> Regards,
> Madhavan

> 	[[alternative HTML version deleted]]

I suggest you investigate how to configure your mail-client to respond in plain text.

> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 Winsemius
Alameda, CA, USA

More information about the R-help mailing list