Yes, that was the original question: when a variable in a data frame is
a matrix instead of an ordinary variable merge() handles the missing
cases so that only the first column of the matrix gets NA and the rest
are recycled. If the matrix is broken to several variables everything
works fine.
Why
This has something to do with your data.frame structure
see
> str(df1)
'data.frame': 3 obs. of 2 variables:
$ a : int 1 2 3
$ X1: 'AsIs' int [1:3, 1:2] 1 2 3 4 5 6
> str(df2)
'data.frame': 2 obs. of 2 variables:
$ a : int 1 2
$ X2: 'AsIs' int [1:2, 1:2] 11 12 13 14
This seems to work
2 matches
Mail list logo