我无法迭代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