It is okay, if I output the column separately
• 0 views
•
link
I have a two column dataset as given below. I want to add a third column which will contain all genes from column 1 and 2, but none of the genes should repeat. How can I do this in R?
ID ID2
Gene1 Gene3
Gene1 Gene5
Gene2 Gene7
Gene2 Gene4
Gene3 Gene6
Gene3 Gene8
Select the two columns (df['ID'], df['ID2']), combine them to a vector (e.g. c()), use the unique() function two remove duplicates. But adding the new vector to the data.frame using cbind will not be possible since it has different length than the original dataframe
Log in to answer this question.
please add an example of column 3
The example of column 3 is given below. It contains all characters of col 1 and 2 but genes names do not repeat