title: Allocating gender variable to new column
body: <p>I kind of have a noob question related to R.
  I have the following data table:</p>
  
  <pre><code>Receiver_id   Sender_id    Gender_receiver
  1             2             Male
  2             3             Female
  3             4             Male
  4             2             Female
  5             3             Female
  </code></pre>
  
  <p>The receiver_id indicates the id_number of the person who received a message, whereas the inviter_id indicates the id_number of the person who send the message. In this case, person 2 sends something to person 1. The gender_receiver refers to the gender of the receiver. However, based on this it should be possible to also indicate the gender of the sender by creating a new column named Gender_sender. Unfortunately, I am not able to do so. I used the following code but without any success:</p>
  
  <pre><code>  dt[, Gender_sender := dt$Gender_receiver, by=Sender_id]
  </code></pre>
  
  <p>I do not get the right allocation of gender.</p>
  
  <p>Somebody knows what I should do, I think it is relatively simple but I cannot figure it out.</p>
  
  <p>Thanks in advance,
  Amanda</p>