I want to identify who are default and voluntary members in an Insurance database. Default members are ones with a certain number of units depending on their age. Voluntary members are any members with more units than default members at that age.
I want to create a column in R that says either "Default" or "Voluntary"
I have a table of the number of units a default member has. For example:
Age Units
18 2
19 2
20 2
21 2
22 2
23 2
24 2
25 3
26 3
27 3
28 3
29 3
30 3
31 4
32 4
33 4
34 4
35 4
36 4
37 4
38 4
39 4
40 4
41 4
42 4
43 4
44 4
45 4
46 4
47 4
48 4
49 4
50 3
51 3
52 3
53 3
54 3
55 3
56 3
57 3
58 3
59 3
60 2
61 2
62 2
63 2
64 2
65 1
66 1
67 1
68 1
69 1
I would usually do this in excel by vlookup-ing the member's number of units and if it equals the default number of units from above table I would say they are default and if not non default.
This is how I would achieve in excel
if( MembersUnits = vlookup(memberage,defaultunitstable,2,0),"Default", "Voluntary")
I expect out put to be "Default" or "Voluntary"