2つのデータフレームがあるとします。私はすべてのデータフレームから業界のc3と言う行を選択し、別のdata.frame、df3に配置したいと考えています。私の実際のデータでn個のデータフレームから1行を取り出し、新しいデータフレームを作成します。R
df1 = data.frame(Industries = c("c1", "c2", "c3", "c4", "c5"), Exports = c(100, 40, 30, 10, 50), Imports =c(90,50,25,15,50))
df2 = data.frame(Industries = c("c1", "c2", "c3", "c4", "c5"), Exports = c(20, 90, 10, 30, 60), Imports =c(40,30,25,55,40))
df1
Industries Exports Imports
1 c1 100 90
2 c2 40 50
3 c3 30 25
4 c4 10 15
5 c5 50 50
df2
Industries Exports Imports
1 c1 20 40
2 c2 90 30
3 c3 10 25
4 c4 30 55
5 c5 60 40
私は、16種類のデータフレームを持っているので、可能な場合にコードが作成される別の1、16個のデータフレームから16行を置くことを許可する必要があります。
'行うに「C3」を有する行のサブセット.call(rbind、lapply(list(df1、df2)、サブセット、Industries == "c3")) '? – Psidom