I am trying to read machine output data with a 21 row header and 2 row footer. Numbers of rows and columns are variable. Just skipping the header causes read.table to choke on the last 2 rows since the number of fields is not the same as the data table. The header contains information for calculating the number of rows. I can successfully pick this out and do the calculation, but cannot get the second read.table() to see the assign the number to "nrows" (the number is correct; if I enter it manually, the everything works fine). Currently the function reads all the way to the end and crashes on the footer. Code follows. # function to read data with header and footer grid.layout <- read.table(fname, as.is=T, header=F, sep="\t", comment.char="", skip=7, nrows=1) row.ctr <- grid.layout[4]*grid.layout[5]*grid.layout[6]*grid.layout[7] # tells me I have the right dimensions ... print(row.ctr) tmp.df <- read.table(fname, as.is=T, header=T, sep="\t", comment.char="", skip=20, nrows=row.ctr ) tmp.df # end function Regards, David McWilliams -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._