I have a dataframe with a date column. These dates represent the date that a particular poll result was actually taken. However, the website takes these results and adds them to a table not necessarily on the date of the poll taking. So for example:
- 20/01/2018
- 21/01/2018
- 20/01/2018
- 19/01/2018
so the date at the top (20/01/2018) came in after the ones below. But the poll below says 21st and thats the date that the poll was taken so the earliest date that the one above could have been added is the 21st thus the list becomes;
- 21/01/2018
- 21/01/2018
- 20/01/2018
- 19/01/2018
and now my column is sorted. I need to do this for like 50 variables! Suggestions? I want to sort my dates column such that if i go from bottom to top of the column if a date has a later date below it, then that date becomes that later date too. enter image description here
str(the_name_of_your_data_frame)and paste the output into the answer? (I can make it a code block if your editor can't perform the 4-space indent)dput(the_name_of_your_data). Easier to reproduce that wayDateis an actual POSIXct date.name_of_your_df <- name_of_your_df[order(name_of_your_df$Date),]