Is there an easy way to alternately merge two columns into one list/dataframe column in R? Essentially I need to do a large series of manipulation of genetic data, sorting etc... and eventually I am left with an identifier and a sequence. What is the easiest way to create a single list that has each identifier above its sequence in a single list?
I have data:
df <- data.frame(genenames = c("gene1", "gene2", "gene3"), seqnes = c("gattaca", "gatgatcca", "catgatcat"))
I would like to get to:
data.frame(c("gene1", "gattaca", "gene2","gatgatcca", "gene3", "catgatcat"))
using either
unite(data, "identifier", "sequence", sep = " ")
will result in all data fuse within a single column as well as stack(......)
Is there an easy or elegant way to do this save starting to look into writing a small loop to iteratively write out the new list?