data.frameを、データフレームの列の1つに基づいた文字のリストに変換する必要があります。
2つの列のdata.frameから開始して、最初の列には化合物名の一意の値が含まれ、もう1つの列には一意ではない化合物タイプのカテゴリが含まれます。例:
Compound_name Compound_type
A Inhibitor_A
B Inhibitor_B
C Inhibitor_A
D Inhibitor_C
E Inhibitor_B
最後に、次のような複合タイプに基づくリストを作成します。
Inhibitor_A 'A' 'C'
Inhibitor_B 'B' 'E'
Inhibitor_C 'C'
私のdata.frameには2000の化合物が含まれているので、それを繰り返し行う方法が必要です。
どこから計算を始めたらいいのかわからないので、よろしくお願いします。
次のsplit
ように使用できます。
split(x$Compound_name, x$Compound_type)
#$Inhibitor_A
#[1] "A" "C"
#
#$Inhibitor_B
#[1] "B" "E"
#
#$Inhibitor_C
#[1] "D"
データ:
x <- structure(list(Compound_name = c("A", "B", "C", "D", "E"), Compound_type = c("Inhibitor_A",
"Inhibitor_B", "Inhibitor_A", "Inhibitor_C", "Inhibitor_B")), class = "data.frame", row.names = c(NA,
-5L))
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加