Now you have an object tmp with columns major, gender, key and value. Note that if you combine the key and gender, we get the column names we want: admitted_men, admitted_women, applicants_men and applicants_women. Use the function unite to create a new column called column_name.
Use the gather function to create a tmp data.frame with a column containing the type of observation admitted or applicants. Call the new columns key and value.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here