How to merge data frame with different length in R by group?

data frame A1
Type  Worker
A  SHARON
B  RUN
C  JACK
D  NICK
K  EMILY

data frame A2
Type  Rate
A     0.39
A     0.78
A     0.22
A     -1.09

...

K     0.56
K     0.73
K     0.88
K     0.04
K     0.69

This is my coding.

K = merge(A1, A2,all.x=T)
Type  Rate
A     0.39
B     0.78
C     0.22
D     -1.09
K     -1.28
A     0.93
B     0.39
...

A     0.56
B     0.73
C     0.88
D     0.04
K     0.69

But my desired output is sorted by worker and type then show the corresponding value. Any ideas on different length of data frame merge?



from Recent Questions - Stack Overflow https://ift.tt/3czw4Hp
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations