I have some issue with R. I try to extract the column with the minimum value in each row. Let me explain :
Test = data.frame(Day1 = c(1,6,3,8), Day2 = c(2,5,4,9)
You can use apply the following to find the minimum value in each row.
Test$minimum <- apply(Test,1,which.min)
Setting a parameter of 1 runs the code which.min over each row of Test.
To get the column name of the minmum column, add colnames(Test) before apply
Test$minimum_day <- colnames(Test)[apply(Test,1,which.min)]
Hope this helps!