[datatable-help] problem with merge(join)

psanjuan drpsanjuan at gmail.com
Fri Feb 23 01:26:39 CET 2018


Hi helpful people.

I have two datasets (tables) I have created in R from a .csv file.
One is emanodrugspr and the other is emadrug
Both tables have the variables:
"PARTICIPANTID" and "SIGNAL"
Both tables roughly look like this but with different variables after SIGNAL

PARTICIPANTID     SIGNAL     value1   value 2
1111                      1             33           3
1111                      2             34           2
1111                      3             36           8
2222                      1             38           2
2222                      2             36           0
2222                      3             NA           0

There are no other common variables across the datasets other than
PARTICIPANTID and SIGNAL
When I merge them almost all the data is fine, except for one PARTICIPANT ID
there are suddenly quadruple SIGNAL values and the corresponding data
doesn't even line up.  All the other data is fine except for this one ID.

Currently I am using this:
emaspread <- left_join(emanodrugspr, emadrug, by=NULL, copy=FALSE)

However, I have used merge also and tried various types of joining and every
time I end up with 60 extra observations that are garbage. 

The data all came from the same place (was downloaded from an online
database). 

(Also, I know those variables have terrible names.)

Any ideas?

Thanks,
Pilar







--
Sent from: http://r.789695.n4.nabble.com/datatable-help-f2315188.html


More information about the datatable-help mailing list