That's one of the things I tried, but which didn't work. I get the following error when I do that:
Error in read.table(file = "don.5.clusters.txt", header = TRUE, comment.char = "", : more columns than column names If I remove the hashes by other means, I don't get that error. On Tue, Oct 26, 2010 at 10:49 AM, Duncan Murdoch <murdoch.dun...@gmail.com>wrote: > On 26/10/2010 10:33 AM, Donald Braman wrote: > >> I'm importing a lot of text tables of data (from Latent Gold) that >> includes >> hashes in some of the column names ("Cluster#1", "Cluster#2", etc.). Is >> there an easy way to strip the offending hashes out before pushing the >> text >> into a table or data frame? I thought I'd use gsub, e.g., but can't >> figure >> out how to read in a text file without reading it into a table or data >> frame >> (which would be ill structured, given the hashes). I could do it in >> another >> scripting language or shell script, but would like to try to do it in R. >> > > readLines() will read it, but you may not need to do that. Set > comment.char="" to turn off the special meaning of # in read.table() and > related functions. > > Duncan > -- Donald Braman phone: 971-645-0607 http://www.culturalcognition.net/braman/ http://ssrn.com/author=286206 http://www.law.gwu.edu/Faculty/profile.aspx?id=10123 [[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.