I've got some results of a DNA sequencing procedure that are not presented in a particularly helpful manner. Currently, the first column my data frame has the species name and the remaining columns contain all the plate wells where DNA from this species was detected. Here is what a sample of the data table looks like:
Species V1 V2 V3 V4 V5
Eupeodes corollae 1-G3 1-F1 1-E11 1-C10 1-A3
Diptera 1-A10 1-B2 1-C1 1-G7 1-E11
Episyrphus balteatus 2-C3 2-A10 1-C11 1-A10 2-B4
Aphidie 1-B9 1-D7 2-A3 1-C8 2-C11
Ericaphis 1-B9 1-D7 2-A3 1-C8 2-C11
Hemiptera 1-B9 1-D7 2-A3 1-C8 2-C11
Ultimately, I would like to end up with a data frame where the first column contains all plate wells and the remaining columns contain all the species that were identified in each well, like this:
Well Species1 Species2 Species3
1-A1 Eupeodes corollae Ericaphis
1-A2 Episyrphus balteatus
1-A3 Aphidie
1-A4 Hemiptera Episyrphus balteatus Aphidie
1-A5 Diptera
I'm guessing that this will be a two-step procedure where the table is first re-shaped to long format with a new record for each well-species match and then a second stage where the records are consolidated so that each well appears just once in the first column and all species found in that well are listed next to the well name. However, I'm afraid this sort of complex reshaping is beyond my capabilites in R. Can anyone advise on how I might go about doing this?