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
Hi,
I have faced a problem with the merge() function when trying to merge
two data frames that have a common index but the second one does not
have cases for all indexes in the first one. With usual variables R
fills in the missing cases with NA if all=T is requested. But if the
variable is a matri
3 matches
Mail list logo