просто положите scanf("%d\n",&loops);
вместо scanf("%d",&loops);
Вам необходимо внести 2 изменения в код, как показано ниже, и фильтры должны работать нормально:
df <- data.frame(ID=c(1,2,3,4,5,6),
Date=c("1900-01-12","2010-12-29","1934-03-17", "1989-09-19","1978-11-27","2010-01-13"),
stringsAsFactors = F) # Ensure your dates are initially strings and not factors
# Actually convert the character dates to Date before writing them to excel
df$Date <- as.Date(df$Date)