If all your columns are arranged as neatly as in the linked example (i.e. if it is a file with a fixed width), then this is the task for read.fwf():
df <- read.fwf(file = "http://dl.dropbox.com/u/54791824/SO_data_frag.txt",
widths = c(8, 7, 29, 15, 16, 16,1000))
head(df,4)
V1 V2 V3 V4 V5 V6 V7
1 82:S 0:dorm 1 1.625420e-06 0.9999968 1.000003
2 83:S 0:dorm 1 1.083245e-06 0.9999979 1.000002
3 84:S 0:dorm 1 1.081771e-06 0.9999979 1.000002
4 85:p N:veg 1 0.000000e+00 1.0000000 1.000000 Fixed
EDIT: Alternatively, as Goran points out in the comments, you can use read.table()with the option fill=TRUE:
df2 <- read.table(file = "http://dl.dropbox.com/u/54791824/SO_data_frag.txt",
fill = TRUE,
col.names=paste("column", 1:7, sep="_")
source
share