Une autre idée : library(tidyr) library(dplyr) Note <- c(0, NA, 0, 1, NA, NA, 1, 2, NA, 3) notes_df <- data.frame( Note = Note, fill_down = Note, fill_up = Note ) notes_df %>% fill(fill_down, .direction = "down") %>% fill(fill_up, .direction = "up") %>% mutate(imputation = ifels...