Hi,
How to transpose this dataframe to long format, please ?
dt <- readr::read_fwf("
Listen_Podcast Transport City_Bikini_Bottom City_Frostbite_Falls City_New_York
Yes Drive 13 17 5
Yes Public 27 25 27
No Drive 23 22 17
No Public 44 31 22
")
dt %<>%
janitor::row_to_names(row_number = 1)
My desired result would be like in here below "Long-format with counts":
https://rcompanion.org/handbook/H_06.html
I just have tried with pivot_longer, but tricky part is that, there is names_sep which I set to "_", but it does not give me what I want. Probably it could be done with names_pattern I suppose. I am still trying, please help.