Assuming the start tag contains the word "start" and the end tag contains the word "end" you could do this:
lines <- readLines( "input.txt" ) # lines is a vector of lines g <- grep( "start|end", lines ) # positions of tags lines <- lines[ seq( g[1]+1, g[2]-1 ) ] mydata <- read.table( textConnection(lines), head=TRUE ) If the scrap only appears before and not after the data then you could shorten this to: lines <- readLines( "input.txt" ) # lines is a vector of lines g <- grep( "start", lines ) # position of tag mydata <- read.table( textConnection(lines), skip=g[1], head=TRUE ) --- Date: Thu, 06 Nov 2003 21:53:08 -0500 From: Mathieu Drapeau <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: [R] R input file scanning Hi, I would like to know how can I solve my problem... I want to load some data (surrounded by a tag) that are stored in a file that contains also some scrap (header and descriptions) that I want to skip. How can I do that? Thanks, Mathieu ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help