[R] 1.8.1 behavior change?

Duncan Murdoch dmurdoch at pair.com
Sat Nov 22 19:45:23 CET 2003

On Sat, 22 Nov 2003 11:57:32 -0500 (EST), you wrote:

>In <R 1.8.1 the following fragment worked properly, now (1.8.1)
>it creates the following warning/error:
>Any advice appreciated.
>  stt <- data.frame()
>  # load all datasets into a dataframe
>  for (ds in 1:n) {
>    stt[ds] <- as.matrix(read.table(fileList[ds]))
>  }

I don't know what you are trying to do here. I can't run this code in
1.7.1 because so much is missing, but I get errors with simple
approximations like this:

> stt <- data.frame()
> stt[1] <- as.matrix(data.frame(a=1:5,b=1:5))
Error in "names<-.default"(*tmp*, value = new.cols) : 
        names attribute must be the same length as the vector
In addition: Warning message: 
Replacement length not a multiple of the elements to replace in

This is not surprising:  stt[1] is a data.frame with no rows or

Could you please give a reproducible example that fails in 1.8.1, but
runs in a recent earlier version?

Duncan Murdoch

More information about the R-help mailing list