Hello,

I want to create a data.frame with different number of columns per line. What I want is something like:

example <- NULL
begin <- 1
while (end < nrow(orig.data))
{
end <- next.day(orig.data,begin) # my own function. It returns the first index from the next day. Each day has a different number of records.
example <- rbind(example, c(begin, end, predictions[c(begin:end)], ...))
begin <- end+1
}

It gives the following warning:

> number of columns of result
        not a multiple of vector length (arg 2) in: rbind(example, c(begin, end, predictions[c(begin:end)], ...

I believe this happen once the number of elements by line are different. The example data.frame repeats the same values for shorter lines until the line is full, i.e., it tries to create lines with the same number of columns.

The question is: How can I create a data.frame with different number of columns?

Any help is very much appreciated

Thanks in advance

Joao Moreira
	[[alternative HTML version deleted]]


