1.0 | 2.0 | 3.0 |
---|---|---|
loud | complaint | problems |
pain | stress | confused |
dull | pain | stress |
this is my data set and I would like to reorganize the rows so that if there is a word that appears in each column it is transferred to a corresponding row. For example
1.0 | 2.0 | 3.0 |
---|---|---|
loud | NA | NA |
pain | pain | NA |
dull | NA | NA |
NA | complaint | NA |
NA | stress | stress |
NA | NA | confused |
NA | NA | problems |
etc., so that every word gets its own row and if the word in that row appears in the column it is matched up with the other columns
I have been looking how to do this but cannot find good code. One idea i was given was create a list of all appearing words and then try to match them to each column but still havent found code for this.
list2DF
isn't necessary; you can just use thenrow
argument:list2DF(lst1, nrow = max(lengths(lst1))
– Ulises