Hi Josh, I'm sorry, it was meant for you. I guess for now that error doesn't matter...for now. Essentially, I want to repeat the conditions that state the following, and continue doing so for several variables.
At the end of the day, I'm only going to keep the couple ID and remove the duplicates. But, before I do that, I want to see how I can write a line/s that will let me observe both sexes (in the couple) and identify which one has a certain characteristic and apply that to a new variable. For instance, if a male moved residence, but the woman did not, migration = 1, else if a woman moved residence, but not the man, migration = 2, else if both man and woman migrated, then migration = 3, etc... else if both man nor woman did not migrate, then migration = 0 However, in order for me to program this and identify them to construct the variables, I have to ensure that both are in the same couple id, and observe both sexes in the couple before I remove the duplicates. I thought the previous example would help me get at this problem, but it still does not make sense to me. Using the newly created coupleid (Thanks to you guys!) this is what I want to see, where mig = migration: 1 = moved and 0 = did not move: coupleid home z sex age mig mig.new 1 01502918 1 1 053 1 3 2 01502918 1 2 049 1 3 3 01502901 1 1 038 0 2 4 01502901 1 2 033 1 2 5 01502902 1 1 036 1 3 6 01502902 1 2 033 1 3 7 01502903 1 1 023 0 0 8 01502903 1 2 019 0 0 9 01502904 1 1 045 0 2 10 01502905 1 2 047 1 2 I hope this makes sense, and thanks again, Josh! Carlos -- View this message in context: http://r.789695.n4.nabble.com/identify-duplicate-from-more-than-one-column-tp4035888p4037652.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.