0

I only need the first survey of a repeating census with the same individuals, so I choose the first time the person gave the interview, which works, but I get a new object without all other variables of the inital df. How can I keep all columns?

df$var1 <- df%>%strptime(var1, "%Y-%m-%d")
survey_1 <- df%>% group_by(per)%>% summarise(var1 = min(var1))
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213

1 Answers1

0

Change summarize to filter

df %>% group_by(per) %>% filter(var1 == min(var1))
Vinícius Félix
  • 8,448
  • 6
  • 16
  • 32