首先,您至少應該給我們一個鏈接到數據框或寫一個代碼來創建數據框。請檢查下面的代碼,看看它是否有效,評論應該使一切都清楚。 :)
set.seed(10) # setting seed for reproducability
data <- data.frame(bla=runif(100), current=runif(100))
head(data)
start = ceiling(0.4*nrow(data))
end = ceiling(0.8*nrow(data))
data[start:end, "current"] # <- this is the interval you are looking for the minimum value, its not the whole dat
min_row = which.min(data[start:end, "current"]) ## you get the minimum value of the interval provided.
# you need to add all of indexes which you have dropped from the start
TRUE_min_row <- min_row + start - 1
# the -1 part comes from the fact that youre a searching between numbers WITH start[1] included
min_row = which.min(data[ ,"current"])
TRUE_min_row == min_row
# as you can see these match