[R] read.table
Berton Gunter
gunter.berton at gene.com
Fri Feb 25 21:23:34 CET 2005
?readLines
I'm sure Perl will do nicely, but you can also use readLines and grep() or
regexpr() the result in R as you would in Perl to find where the problem
lies. ?nchar can also help to find a non-printing character that may be
messing you up. It's no fun, I know. Excel files can be a particular pain,
especially in their handling of missings.
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Sean Davis
> Sent: Friday, February 25, 2005 12:12 PM
> To: r-help
> Subject: [R] read.table
>
> I have a commonly recurring problem and wondered if folks would share
> tips. I routinely get tab-delimited text files that I need
> to read in.
> In very many cases, I get:
>
> > a <- read.table('junk.txt.txt',header=T,skip=10,sep="\t")
> Error in scan(file = file, what = what, sep = sep, quote =
> quote, dec =
> dec, :
> line 67 did not have 88 elements
>
> I am typically able to go through the file and find a single quote or
> something like that causing the problem, but with a recent set of
> files, I haven't been able to find such an issue. What can I
> do to get
> around this problem? I can use perl, also....
>
> Thanks,
> Sean
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list