Question: Now use the admissions dataset to create the object tmp , which has columns major, gender, key and value: tmp < - admissions % >

Now use the admissions dataset to create the object tmp, which has columns major, gender, key and value: tmp <- admissions %>% pivot_longer(cols = c(admitted, applicants), names_to = "key", values_to = "value") tmp Combine the key and gender and create a new column called column_name to get a variable with the following values: admitted_men, admitted_women, applicants_men, and applicants_women. Save the new data as tmp2. Which command could help you to wrangle the data into the desired format? tmp2<- pivot_wider(tmp, names_from = column_name, values_from = key, gender) tmp2<- pivot_longer(tmp, names_to = "column_name", values_to = c("gender", "key")) tmp2<- unite(tmp, column_name, c(gender, key)) tmp2<- pivot_wider(tmp, names_from = column_name, values_from = c(key, gender)) tmp2<- unite(tmp,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!