I have a dataframe, df and lets say it has two columns, Score & Gender.
I want to create a vector based on the gender, for example if a row has a gender value of 'male' the I want the value to be 'b' and if the value is 'female' I want the value to be 'r'
I know I can loop through the rows of a dataframe however I read that its better to use vectorisation. So without looping through the dataframe how would I obtain the vector (Result I want)?
Score Gender Result I want
34 male b
22 male b
29 female r
25 male b
36 female r