0

I have a list of countries with the cumulative amount of cases (csum colum) by date in my dataframe (df)

I am trying to group by country and pull out the earliest date per country.

I tried the following code, but the dates it returns are incorrect:

df_2 = aggregate(df$date, by = list(df$country), FUN = "min")

Would anyone be able to see where i'm going wrong (p.s: I need to avoid using any libraries)

Thanks :)

data frame:df

neilfws
  • 32,751
  • 5
  • 50
  • 63
  • 3
    Welcome to Stack Overflow. Please [make this question reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including example data in a plain text format - for example the output from `dput(df)`. We cannot copy/paste data from images. – neilfws Nov 11 '20 at 22:24
  • As mentioned, it is preferable if you present your data using `dput`, as well as showing your desired result. Possibly, you may want something like `aggregate(date ~ country, min, data = df)` – Ben Nov 11 '20 at 23:27

0 Answers0