[R] R -- for help
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Oct 24 08:11:32 CEST 2003
Look at the `fill' argument in ?read.table.
This fills with NAs, but you can convert those to 0's later (although
it may be better to do this in the analysis).
On Thu, 23 Oct 2003, jbwu wrote:
> hi, guys:
> I have a question on how to read data from file in which the length of each
> line is unfixed.
>
> For instance, the data in sample.dat are:
> 1 2 3 4
> 5 6 7
> 8
>
> I want to read this kind of data into a matrix as:
> 1 2 3 4
> 5 6 7 0
> 8 0 0 0
--
Brian D. Ripley, ripley at stats.ox.ac.uk
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
More information about the R-help
mailing list