I've got a dataframe of the following pattern:
tibble [9 x 2] (S3: tbl_df/tbl/data.frame)
$ Date: chr [1:9] "Tuesday 4 October 2022" "Wednesday 5 October 2022" "Thursday 6 October 2022" "Note that:"
$ EVENTS CALENDAR : chr [1:9] "A61" "A32" "A51" "29 Jan 2029"
I'd like to drop the entire row containing "Note:" in the first column, and "29 Jan 2029" in the second column (found at the bottom of the dataframe).
I've been able to achieve it quite easily by using:
df <- df[!grepl("Note that:", df$`Date: 15-Oct-2022`),]
However given that the "Date: 15-Oct-2022" title will change on the day, I'd like to come up with a more dynamic solution to removing this redundant row.
Attempting to drop by column index using grepl does not work, and seems to blank the entire dataframe.
Once I've removed that final row, I've attempted to convert the date field to a more traditional format using:
df$`Date: 15-Oct-2022` <- as.Date(df$`Date: 15-Oct-2022`, format = "%A %d %B %Y")
Though again trying to use column indexing to do that conversion leads to an error for what I imagine to be similar reasons.
Any advice would be most appreciated.