[R] Regex for Special Characters under Grep

From: Gundala Viswanath <gundalav_at_gmail.com>
Date: Fri, 13 Jun 2008 10:42:37 +0900


Hi all,

I am trying to capture lines of a file that DO NOT start with the following header: !, #, ^

But somehow my regex used under grep doesn't work.

Please advice what's wrong with my code below.

__BEGIN__

in_fname <- paste("mydata.txt,".soft",sep="") data_for_R <- paste("data_for_R/", args[3], ".softR", sep="")

# my regex construction
cat(temp[-grep("^[\^\!\#]",temp,perl=TRUE)], file=data_for_R, sep="\n")

dat <- read.table(data_for_R)
___END__


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 Fri 13 Jun 2008 - 01:51:18 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 Fri 13 Jun 2008 - 03:31:19 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