Re: [R] Ignoring initial rows in a text file import

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Tue, 01 Jun 2010 18:33:29 +0200

On 01.06.2010 02:19, David Winsemius wrote:
>
> On May 31, 2010, at 8:14 PM, jim holtman wrote:
>
>> try this:
>>
>> input <- readLines("yourfile.txt")
>> # determine start
>> start <- grep("\tBegin Main\t", input)[1] # first line if many
>
> Puzzled. I thought backslashes in grepping patterns needed to be
> doubled? I guess not.
>

Well, yes, for a backslash, but here a tab is specified, but no backslash at all.

Additionally, see ?regex:
"The current implementation interprets \a as BEL, \e as ESC, \f as FF, \n as LF, \r as CR and \t as TAB."

Uwe Ligges



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. Received on Tue 01 Jun 2010 - 16:35:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Jun 2010 - 16:40:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive