I'm pretty new to R and I'm trying to create some new variables. Basically my dataset has individuals with a variable for mother ID (i.e. if two individuals have the same mother the value of this variable will be the same).
Keeping it simple to begin with, lets say I want to create a dummy variable that = 1 if two individuals are siblings. I tried using:
dummy <- as.numeric(duplicated(Identifiers_age$MPUBID) = TRUE)
but the vector I get only = 1 for one of the siblings. What should I be doing?
Thanks