[R] More difficulties in getting data into R

From: Ajay Shah <ajayshah_at_mayin.org>
Date: Mon 05 Jul 2004 - 20:58:39 EST


In order to get around the problems of my posting a few minutes ago, I thought:

$ awk -F\| '(NR > 2) {print $2}' cmie_firm_data.text > col2
$ awk -F\| '(NR > 2) {print $4}' cmie_firm_data.text > col4
$ paste col2 col4 | head -2

-510.45 -510.27
60700 101900
$ paste col2 col4 | tail -2
28648.12        31617.02
491014.77       494308.52

$ wc -l col2 col4
  89323 col2
  89323 col4
 178646 total

So all is well.

But R doesn't like it:

$ R --vanilla < picture.R

R : Copyright 2004, The R Foundation for Statistical Computing Version 1.9.1 (2004-06-21), ISBN 3-900051-00-3

> col2 <- read.table(file="col2")
> col4 <- read.table(file="col4")
> print(nrow(col2))

[1] 89323
> print(nrow(col4))

[1] 88746

Why might I be getting 89,323 and 88,746 obs for two files which `wc' believes are each 89,323 lines long?

I checked, and there is no single quote or C-m in either file.

-- 
Ajay Shah                                                   Consultant
ajayshah@mayin.org                      Department of Economic Affairs
http://www.mayin.org/ajayshah           Ministry of Finance, New Delhi

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Mon Jul 05 21:02:32 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:31:55 EST