On 31/05/2010 7:07 AM, Alex van der Spek wrote:
Using read.table now on large files. Scan should be faster reading and parsing the files if a 'what' list is provided.

How would I generate a what list that repeats the the last 4 elements n (n=14 or 10 or 8) times?

whatlist=list(Tstamp="",Condition=0,A1=0,B1=0,C1=0,D1=0)

All are numeric, either decimal or hexadecimal.


Do it like this:

n <- 14
indices <- c(1,2, rep(3:6, n))
biglist <- whatlist[indices]


This repeats the names too; if you want new names for the repeated columns, you can reassign the names afterwards, e.g.

names(biglist) <- paste("name", 1:(2+4*n))

Duncan Murdoch

______________________________________________
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.

Reply via email to