我無法迭代data.Frame。R通過數據幀進行迭代的結果是什麼?
# a is a dataframe, with names 'f','d','sess', ...
for (x in a)
# find all events BEFORE the event x
# ('d' is the beginning of the event in ms, 'e' is the end of it)
a[a$f < as.numeric(x['d']),] -> all_before
x['Epe'] = min(as.numeric(x['d'])-all_before$f)
}
它只是不會改變我原來的data.frame。有沒有辦法改變我的一個數據幀在運行中,或者我應該絕對創建一個新的並填寫它? 謝謝!
能詳細說明一下你想要什麼嗎?通常不需要明確的'for'循環。 – 2013-04-23 19:21:09
而且請提供示例數據,這段代碼相當神祕。 – 2013-04-23 19:22:14