0

I have this dataframe, with the following variables:

amostra_coc02 <- c("AI-0006-LT01-T1-1", "AI-0006-LT01-T1-1")
equipamento_coc02 <- c("FZ-001-CP", "FZ-001-CP")
data_coc02 <- c("2022-06-09", "2022-06-09")
data_coc03 <- c("2022-06-13", "2022-06-13")
data_medicao <- c("2022-06-11", "2022-06-12")
temperatura <- c("-28", "-29")

df <- data.frame(amostra_coc02 , equipamento_coc02, data_coc02, data_coc03, data_medicao, temperatura, datas_faltantes)

In the interval from 2022-06-09 to 2022-06-13, temperature measurements were taken on 2022-06-11 and 2022-06-12 as indicated in the "data_measurement" field.

I need it to return the dates 2022-06-09 / 2022-06-10 / 2022-06-13 I have several records in my dataframe, where I need to return these intervals.

I tried something like:

mutate(aux = first(data) + row_number() - 1)%>%

but for the most recent dates this doesn't work

Mark
  • 7,785
  • 2
  • 14
  • 34
fdpr
  • 1
  • 1
  • 2
    What specific output do you want? `df |> tidyr::separate_rows(datas_faltantes, sep = " / ")` will output rows with each of those missing dates in that column, you could add `|> pull(datas_faltantes)` to get those as a vector. – Jon Spring Aug 08 '23 at 15:18
  • group_by(amostra_coc02) %>% summarise(datas_faltantes = paste(datas_faltantes, collapse = " / ")) – fdpr Aug 08 '23 at 15:19
  • In your assignment of `df`, you include `datas_faltantes` ("missing data" in Spanish? Forgive this unilingual American...;-)), but there's no vector for it above, so you are trying to create that, right? (throws an error since it's not included). I don't follow what your end result is supposed to be -- can you post what the ending df should be? Where is **"2022-06-09 / 2022-06-10 / 2022-06-13"** supposed to go? – ScottyJ Aug 14 '23 at 13:18

0 Answers0