[R] How can I read the following complicated table

Rainer Schuermann rainer.schuermann at gmx.net
Fri Dec 14 05:44:04 CET 2012


What have you tried so far that did not work, and what do you want the result of your reading the text file look like? What is "store somewhere"?

Why does 

> myDF <- read.table( "myData.txt" )

which gives you

> myDF
         V1 V2 V3 V4
1    Monday 12 78 89
2   Tuesday 34 44 67
3 Wednesday 78 98  2
4  Thursday 34 55  4

as a starting point, not suffice?

Rgds,
Rainer


On Friday 14 December 2012 10:50:56 jpm miao wrote:
> Hello,
> 
>    I have a table (in a txt file) which look like this:
> 
> Monday 12 78 89
> Tuesday 34 44 67
> Wednesday 78 98 2
> Thursday 34 55 4
> 
>    Then the table repeats Monday , Tuesday, ... followed by several numbers
> 
>    My goal is to read values after the table. My problem is a little more
> complicated, but I just present a simpler case for ease of illustration. Is
> there any way to ask R to "read several number after you see the word
> 'Monday' and store somewhere", and read several number after you see the
> word 'Tuesday' and store somewhere"?
> 
>   Thanks,
> 
> miao
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org 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.




More information about the R-help mailing list