Re P.S. I plan to generate code that'll let
you read the whole thing into R as a list.
How do I specify the header? If I have a
simple scalar x and a 2-D array y, I'd like to write
a header like:
# x, y[,1], y[,2]
but I can't figure out how to get R to accept
anything like this or manipulate it once it's
written. So I was thinking I'd just do something
roughly as follows (only getting all the R right):
read_file <- function(path) {
sample_matrix <-
as.array(scan(path)),
dims=c(num_samples,num_params),
byrow=T);
y[,1] <- sample_matrix[,1];
y[,2] <- sample_matrix[,2];
params <- list(y=y,...);
return params;
}
The right thing to do would be to generate C++ code
to write directly into R. But I probably want the
file-based thing, too.
- Bob