1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

R dataframe, changing the value in a variable with a value from the same variable [duplicate]

Discussion in 'Programming/Internet' started by Kp_Data, Sep 12, 2018.

  1. Kp_Data

    Kp_Data Guest

    This question already has an answer here:


    I have a Data Frame which looks like this

    ID Name Surname Country Unique_number
    1 John Snow UK 12345
    1 John Anderson USA 53214
    1 John David UK NA
    2 Kim Snow UK 62321
    2 Kim Anderson USA 77832
    2 Kim David UK NA


    I want a data from which will look like this (Notice the change in unique_number )

    ID Name Surname Country Unique_number
    1 John Snow UK 12345
    1 John Anderson USA 53214
    1 John David UK 12345
    2 Kim Snow UK 62321
    2 Kim Anderson USA 77832
    2 Kim David UK 62321


    Can someone help with to do this in R studios ?

    Thank you

    Login To add answer/comment
     

Share This Page