Hi I have a data set with few variables.
AGE | Gender | Smoking | DM | TC | HDL | BP |
---|---|---|---|---|---|---|
30 | f | no | Low | 2 | 4 | 2 |
30 | m | no | Low | 3 | 4 | 1 |
30 | f | no | Low | 3 | 4 | 1 |
30 | f | no | Low | 4 | 4 | 1 |
30 | f | no | Low | 3 | 4 | 1 |
30 | m | yes | Low | 1 | 4 | 1 |
30 | f | no | Low | 3 | 4 | 1 |
30 | m | no | Low | 2 | 4 | 4 |
30 | m | no | Low | 2 | 2 | 2 |
30 | m | no | Low | 3 | 1 | 1 |
30 | f | no | Low | 3 | 5 | 1 |
30 | f | no | High | 3 | 2 | 3 |
30 | m | no | Low | 3 | 2 | 3 |
30 | m | no | Low | 3 | 2 | 2 |
30 | f | no | Low | 3 | 4 | 3 |
30 | m | no | Low | 5 | 4 | 1 |
30 | m | no | High | 1 | 5 | 4 |
30 | m | no | Low | 5 | 2 | 2 |
30 | f | no | Low | 3 | 4 | 1 |
30 | f | no | Low | 3 | 4 | 3 |
30 | f | no | Low | 3 | 2 | 1 |
30 | f | no | Low | 4 | 4 | 1 |
30 | f | no | Low | 3 | 4 | 1 |
I have 2 seperate equations for male and female. They go as if male
A male= Age*5 + 1(if TC=1)+2(ifTC=2) +3(if TC=3) +1(HDL=1)+2(HDL=2)+3(HDL=3) +5(if smoking) +8(if DM=High)
How am I to tackle this. I am new to r and I can see no way around?
I want to create IFELSE statements and solve this equation and get the replies to a seperate column