[R] Merging data.table and data.frame

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue May 13 15:30:03 CEST 2014


Because merge.data.table expects both objects to be data.table objects?
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On May 13, 2014 5:34:32 AM PDT, Abhinaba Roy <abhinabaroy09 at gmail.com> wrote:
>Hi R-helpers,
>
>I am trying the following code in R
>
>merge(x=Master1,y=demo_dtls,by.x=c("ID_CASE","ts"),by.y=c("ID_CASE","TS_EVENT"))
>
>where,
>
>class(demo_dtls$TS_EVENT)
>[1] "POSIXct" "POSIXt"
>class(Master1$ts)
>[1] "POSIXct" "POSIXt"
>
>and
>
>> class(Master1)[1] "data.table" "data.frame"> class(demo_dtls)[1]
>"data.frame"
>
>
>But I am getting the following error
>
>Error in merge.data.table(x = Master1, y = demo_dtls, by.x =
>c("ID_CASE",  :
>  Can not match keys in x and y to automatically determine appropriate
>`by` parameter. Please set `by` value explicitly.
>
>Why am I getting this error?
>Any help will be appreciated



More information about the R-help mailing list