[R] Problem reading in table with extra spaces

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Aug 5 22:30:39 CEST 2000


Paul E Johnson wrote:
> 
> I wrote with C and created a file that I can read into S+, but R chokes
> because I've got multiple spaces between some variables and there is a
> space at the start of each data line.  This happens becuase C was
> right-justifying the numbers as it printed them out.  It looks like
> this:
> 
> T Run Seed IntAct Change f0 f0T0 f0T1 f0T2 average0 variance0
> relentropy0 f1 f1T0 f1T1 f1T2 average1 variance1 relentropy1 f2 f2T0
> f2T1 f2T2 average2 variance2 relentropy2 f3 f3T0 f3T1 f3T2 average3
> variance3 relentropy3 f4 f4T0 f4T1 f4T2 average4 variance4 relentropy4
> totalEntropy acquaint harmony identical
>  960 0 807089772  43   0 f0 42 22 36 0.940000 0.770000 0.969635 f1 32 38
> 30 0.980000 0.610000 0.995340 f2 24 38 38 1.140000 0.590000 0.981121 f3
> 31 40 29 0.980000 0.590000 0.990856 f4 41 27 32 0.910000 0.710000
> 0.986421 0.707571 0.435000 0.628316 0.413000
>  840 1 695491788  48   0 f0 41 29 30 0.890000 0.680000 0.988275 f1 23 36
> 41 1.180000 0.600000 0.975208 f2 35 26 39 1.040000 0.720000 0.987522 f3
> 31 33 36 1.050000 0.660000 0.998277 f4 28 40 32 1.040000 0.590000
> 0.989945 0.706440 0.435000 0.579580 0.356000
> 
> Can you tell me what to do?  Perhaps I need tips on formatting output
> from C as well, but I would really really like to just read in this data
> without running the models over again.

I tried to read it in using R-1.1.0 on WinNT4.0:

 read.table("c:/blah/test.txt")

and it works fine for me.

Please give some informations about your system, your version of R and
how you tried to solve your problem, then you will get faster and maybe
better answers from this list.

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list