On Fri, 22 Aug 2008, Daniel Folkinshteyn wrote:
on 08/22/2008 10:19 AM Martin Ballaschk said the following:
how do I read files that have two header fields less than they have
columns? The easiest solution would be to insert one or two additional
header fields, but I have a lot of files and that would be quite a lot of
awful work.
Any ideas on how to solve that problem?
you could use read.table with "header = F", that way it will read the table
without worrying about column names (they will end up in the first row of the
data).
Or, better, use header=FALSE, skip=1 and the col.names arg of
read.table().
Then, you can just delete the first row, or assign it to names(), or
whatever.
if all the columns in all your files have the same names, you can read them
all with header=F and col.names=vectorofcolumnnames, and then delete first
row (which will contain the incomplete col names from the file).
The trouble with that approach is that your will get all factor columns.
hope this helps :)
______________________________________________
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.
--
Brian D. Ripley, [EMAIL PROTECTED]
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
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.