如何将表的多个列合并为R中的1 [英] How to merge multiples columns of a table into 1 in R
本文介绍了如何将表的多个列合并为R中的1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含多列(t1,t2,t3,t4,t5,t6
)的数据帧(control.sub
).我想将所有这些列合并为一个,也应删除NA.
I have a data frame (control.sub
) containing multiple columns (t1,t2,t3,t4,t5,t6
). I want to merge all these columns into one, also NA should be removed.
> control.sub
t1 t2 t3 t4
29 5500024017802120306174.H01 5500024017802120306174.G02 5500024017802120306174.E03 5500024017802120306174.D04
810 5500024030401071707292.H01 5500024030401071707292.G02 5500024030401071707292.E03 5500024030401071707292.D04
4693 5500024035736031208612.G08 5500024035736031208612.E09 5500024035736031208612.D10 5500024035736031208612.B11
t5 t6
29 5500024017802120306174.B05 5500024017802120306174.A06
810 5500024030401071707292.B05 5500024030401071707292.A06
4693 5500024035736031208612.A12 <NA>
我希望最终结果为:
> control.sub
t1
29 5500024017802120306174.H01 5500024017802120306174.G02 5500024017802120306174.E03 5500024017802120306174.D04
810 5500024030401071707292.H01 5500024030401071707292.G02 5500024030401071707292.E03 5500024030401071707292.D04
4693 5500024035736031208612.G08 5500024035736031208612.E09 5500024035736031208612.D10 5500024035736031208612.B11
5500024017802120306174.B05 5500024017802120306174.A06
5500024030401071707292.B05 5500024030401071707292.A06
5500024035736031208612.A12
一列(t1)包含所有值.
One columns (t1) containing all values.
推荐答案
查看全文