Hello,

This solves my problem in a horribly inelegant way that works:

df <- data.frame(n=newInput$n, iter=newInput$iter, Error=newInput$Error, Duality_Gap=newInput$Duality, Runtime=newInput$Acc)
df_last <- aggregate(x=df$iter, by=list(df$n), FUN=max)
names(df_last)[names(df_last)=="Group.1"] <- "n"
names(df_last)[names(df_last)=="x"] <- "iter"
#     n  iter
#1 1000  2518
#2 2000  5700
#3 3000 10026
#4 4000 13916
#5 5000 17962

df$last <- FALSE
df$last[df$n == 1000 & df$iter == 2518] <- TRUE
df$last[df$n == 2000 & df$iter == 5700] <- TRUE
df$last[df$n == 3000 & df$iter == 10026] <- TRUE
df$last[df$n == 4000 & df$iter == 13916] <- TRUE
df$last[df$n == 5000 & df$iter == 17962] <- TRUE

df <- subset(df, (iter %% 500 == 0) | (df$last == TRUE))

How can I do the same without hardwiring these numbers?

TIA,
Best regards,
Giovanni
	[[alternative HTML version deleted]]


