Dear R users
The following question looks simple but I have spend alot of time to solve
it. I would highly appeciate your help.
I have following dataset from family dataset :
Here we have individuals and their two parents and their marker scores
(marker1, marker2,....and so on). 0 means that their parent information not
available.
Individual Parent1 Parent2 mark1 mark2
1 0 0 12 11
2 0 0 11 22
3 0 0 13 22
4 0 0 13 11
5 1 2 11 12
6 1 2 12 12
7 3 4 11 12
8 3 4 13 12
9 1 4 11 12
10 1 4 11 12
I want to recode mark1 and other mark2.....and so on column by looking
indvidual parent (Parent1 and Parent2).
For example
Take case of Individual 5, who's Parent 1 is 1 (has mark1 score 12) and
Parent 2 is 2 (has mark1 score 11). Individual 5 has mark1 score 11. Suppose
I have following condition to recode Individual 5's mark1 score:
For mark1 variable, If Parent1 score "11" and Parent2 score "22" and recode
indvidual 5's score, "12"=1, else 0
If Parent1 score "12" and Parent2 score
"22" and recode individual 5's score, "22"=1, "12"= 0.5, else 0
.........................more conditions
Similarly the pointer should move from individual 5 to n individuals at the
end of the file.
Thank you in advance
Umesh R
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.