Mixed Merge in R - Subscript solution?

前端 未结 2 809
无人及你
无人及你 2021-02-06 16:09

Note: I changed the example from when I first posted. My first example was too simplified to capture the real problem.

I have two data frames

2条回答
  •  死守一世寂寞
    2021-02-06 16:28

    NOTE: Check the 5th comment on the answer above. Solution should be

    s1$index <- with(s1,ave(value1,state,FUN=seq_along))
    s2$index <- with(s2,ave(value2,state,FUN=seq_along))
    

    Tested and working.

提交回复
热议问题