Не уверен, что это быстрее, чем ваша функция, но давайте попробуем:)
testdata = matrix(c(
45, "2018-01-01", "2018-01-10",
40, "2018-01-01", "2018-01-07",
48, "2018-01-01", "2018-01-10",
49, "2018-01-01", "2018-01-10",
42, "2018-01-01", "2018-01-10",
69, "2018-01-01", "2018-01-07"), ncol = 3, byrow = T)
testdata[,1] = as.numeric(testdata[,1])
testdata = data.table(testdata)
names(testdata) = c("price", "date_i", "date_f")
# create a table with min values for all date_i date_f combinations
lowest = testdata[,list(min = min(price)), list(date_i, date_f)]
# attach the min-values to your dataframe by date_i and date_f
# there might be a faster data.table merge function
testdata = merge(testdata, lowest, by = c("date_i", "date_f"), all.x = T)
# if price is bigger than min write No to result, else yes
testdata$result = ifelse(testdata$price > testdata$min, "No", "Yes")