我想知道如何将完整循环输出的值存储到 R 中的单个数据帧中。例如,
for(i in unique(x$id)){
.
.
.
y=output of one iteration}
Run Code Online (Sandbox Code Playgroud)
在每次迭代结束时,我都会在 y 中获得输出。但我想将所有迭代的输出存储到 y 中。我如何在 R 中做到这一点?
我是R编程的新手,我需要一个帮助来根据单个列的值删除整行.如果单个列中的值等于前一行值,我想删除该行.
以下是我的数据,
x.id x.timestamp x.count
71 1 1435114605 61
72 1 1435114606 61
73 1 1435114659 61
74 1 1435114719 62
75 1 1435114726 62
76 1 1435114780 62
77 1 1435155998 62
78 1 1435156059 62
79 1 1435156076 62
80 1 1435156119 62
Run Code Online (Sandbox Code Playgroud)
在这里,我想根据x $ x.count值删除行.
我的输出应该是,
x.id x.timestamp x.count
71 1 1435114605 61
74 1 1435114719 62
Run Code Online (Sandbox Code Playgroud)
我不能在这里使用重复或唯一的功能,因为稍后在数据集中重复相同的值.我只想根据以前的值删除数据.