"Reduce" adds unrequested attributes to result

Viewed 55

Contrast the following two code snippets:

1.

> a <- cbind(1,2)
> a
     [,1] [,2]
[1,]    1    2
> str(a)
 num [1, 1:2] 1 2

2.

> b <- Reduce(cbind, list(1,2))
> b
     init  
[1,]    1 2
> str(b)
 num [1, 1:2] 1 2
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:2] "init" ""

According to the Reduce help page, i would expect a and b to be the same, but they're obviously not quite. Why is it?

2 Answers
Related