I have a very long data frame that looks like this
owner cat dog ........... monkey elephant rhino giraffe James 1 2 44 22323 NA 13
for each owner(unique row), i am interested in seeing which of the 88 animals they have by creating a string. if they have even one animal in a given column, I want it to count. I want the output to look like this for every row in a new variable called "animal_list":
owner animal_list James cat, dog, monkey, elephant, giraffe
I also want another column that tells me the number of occurrences ordered from most common column to least:
owner animal_list_number James elephant (22323), monkey (44), giraffe (13), dog (2), cat (1)
is this possible to do using tidy verse principle. thank you !