I have this data frame:
data_df <- data.frame(requests = c(300,400,500), approvals = c(35,48,52), loans = c(14, 22, 23), id_month = c("Jan-19","Feb-19","Mar-19"), stringsAsFactors = FALSE) I want to set the table using months as cols. So firstly I transposed it:
data_df %>% t() This is the result:
[,1] [,2] [,3] requests "300" "400" "500" approvals "35" "48" "52" loans "14" "22" "23" id_month "Jan-19" "Feb-19" "Mar-19" But I don't know how to put row "id_month" as column header. Besides all values seem to be characters and not numbers (perhaps because each column contains a character row). This should be the expected result:
Jan-19 Feb-19 Mar-19 requests 300 400 500 approvals 35 48 52 loans 14 22 23 Any help in tidy verse will be greatly appreciated. Thank you in advance.