As you see in the data.. each section has table header followed by a row of table column headers and then rows of data. I felt read.table may not be the optimal function to extract both the texts (headers) and numerics (rows&columns of data). As of now, I use "scan" to get the text boundaries and use read.table to read the data within those boundaries. I wanted to know if there is more efficient way of handling disparate sets of data
Thanks, Santosh On Tue, Sep 8, 2009 at 6:37 PM, jim holtman <jholt...@gmail.com> wrote: > How do you want to extract the data? You can use 'readLines' to read > in the data and then 'grep' to find the header lines and delete them. > On the other hand, do you want to separate each section into a > differnet object/list? You can again use readLines and determine > where the breaks are and then split the data into different segments > to read in. > > On Mon, Sep 7, 2009 at 4:00 AM, Santosh<santosh2...@gmail.com> wrote: > > Dear R experts.. > > > > I am trying to read data-sections in a large consolidated dataset, > > containing section headers and the data . There are many options > available > > to implement, I was wondering what optimal function, to extract section > > headers and data (w/ columns), could be used on the dataset that looks > like > > as provided at the end of this email? In each section of a dataset, 1st > line > > of the section is a table title, followed by names of the columns and > rows > > of data. > > > > TABLE NO. 4: MCMC Bayesian Analysis > > ITERATION THETA1 THETA2 THETA3 THETA4 > > SIGMA(1,1) OMEGA(1,1) OMEGA(2,2) OBJ > > -10000 1.63523E+00 1.56116E+00 7.51601E-01 2.35158E+00 > > 5.71097E-02 1.66941E-01 1.39843E-01 -2573 > > -9999 1.60770E+00 1.48763E+00 7.25607E-01 2.41005E+00 > > 4.15829E-02 1.75023E-01 1.14078E-01 -2588 > > -9998 1.67015E+00 1.50197E+00 8.04380E-01 2.32958E+00 > > 4.60430E-02 1.68910E-01 1.70382E-01 -2548 > > -9997 1.60714E+00 1.56161E+00 7.36944E-01 2.37716E+00 > > 4.96144E-02 1.35797E-01 1.62153E-01 -2539 > > > > Thanks > > Santosh > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@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. > > > > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem that you are trying to solve? > [[alternative HTML version deleted]] ______________________________________________ R-help@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.