Hi Josh,
thanks, that worked!
For the record, here is a function to determine the
number of strings, space-separated, in the first line
of a file:
# Removes leading and trailing whitespaces from string x:
trim = function(x) gsub("^\\s+|\\s+$", "", x)
# The number of strings in the first line in
Hi Oliver,
Look at ?readLines
I imagine something like:
tmp <- readLines(filename, n = 1L)
(do stuff with the first line to decide)
IntN <- 6 (or 4)
NumN <- 8 (or whatever)
E <- read.table(file = filename, header = TRUE, colClasses =
c(rep("integer", IntN), "numeric", "integer", rep("numeric",
Hello,
I have a function for reading a data-frame from a file, which contains
E = read.table(file = filename,
header = T,
colClasses = c(rep("integer",6),"numeric","integer",rep("numeric",8)),
...)
Now a small variation arose, where
colClasses = c(rep("integer",4),"nu
3 matches
Mail list logo