【发布时间】:2019-11-04 08:51:10
【问题描述】:
我有一个数据集,其中我从每种不同的实验方法(梯度、等度和 HILIC)中识别出化合物。我希望能够存储/子集结果,以便我获得在所有三种方法中识别的化合物,每种方法独有,以及两种方法之间的重叠。最终,我将能够在三种方法和已识别的化合物之间创建一个维恩图类型的图形。
我在“Compound”列上尝试了“unique()”和“subset()”,但我不知道如何为该方法添加另一个条件。
'''head(Data, n = 12)'''
Precursor.Ion Compound Method
1 141 Methanol Gradient
2 143 Methanol Gradient
3 82 Toluene Gradient
4 54 Isopropanol Gradient
5 47 Water Gradient
6 45 Water Gradient
7 135 Toluene Isocratic
8 82 Acetonirile Isocratic
9 91 Acetone Isocratic
10 43 Toluene HILIC
11 31 Isopropanol HILIC
12 97 Methyltertbutylether HILIC
'''unique(Data$Compound)'''
Methanol Toluene Isopropanol Water
Acetonirile Acetone Methyltertbutylether
我希望输出是这样的,存储在以下变量中
'''All'''
Toluene
'''Gradient'''
Methanol Water
'''Isocratic'''
Acetone, Acetonitrile
'''HILIC'''
Methyltertbutylether
'''Gradient and Isocratic'''
N/A
'''Gradient and HILIC'''
Isopropanol
'''Isocratic and HILIC'''
N/A
【问题讨论】:
标签: r duplicates subset unique