Desktop Survival Guide
by Graham Williams

Fixed Width Data

Suppose we have a fixed-width data file with fields of 10 and 5 characters each.

> lines <- readLines("mydata.dat")
> dframe <- data.frame(salary = as.numeric(substr(lines, 1, 10),
                       age = as.numeric(substr(lines, 11, 15))

Copyright © Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010