I have asked these question before and solve the problem with Saga's help. I am working on a simulation study. I have to reorganize my results and continue to analysis.
I have a data matrix contains may results like this
> data
It S X Y F
1 1 0.5 0.8 2.39
1 2 0.3 0.2 1.56
2 1 1.56 2.13 1.48
3 1 2.08 1.05 2.14
3 2 1.56 2.04 2.45
.......
It shows iteration S shows second iteration working inside of IT X shows coordinate of X obtained from a method Y shows coordinate of Y obtained from a method F shows the F statistic.
My problem is I have to find minimum F value for every iteration. So I have to store every iteration on a different matrix or data frame and find minimum F value.
I have tried many things but not worked. Any help, idea will be appreciated.
EDIT: Updated table information
This was the solution:
library(dplyr)
data %>% group_by(It) %>% slice(which.min(F))
A tibble: 3 x 5
Groups: It [3]
It S X Y F
1 1 2 0.30 0.20 1.56 2 2 1 1.56 2.13 1.48 3 3 1 2.08 1.05 2.14
However , I will continue another for loop and I want to select every X values providing above conditions.
For example when I use data$X[i] This code doesn't select to values of X (0.30, 1.56, 2.08). It selected original values from "data" before grouping. How can I solve this problem?