Help with removing duplicates rows but keep certain rows in a data.frame

Is "Unknow" different than "unknow"? R is case-sensitive and so these would be considered as 2 separate animal categories.

Changing all to uppercase was standardizing the animal names in case that "dog" is to be treated the same as "Dog".

I've also explicitly coded the Animals with names that were zero-length strings or just composed of spaces as NA.

library("dplyr")
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library("tidyr")
library("lubridate")
#> 
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union

Animal<-c("Unknow"," ","Dog","cat","Lion","unknow","horse","dog","unknow","cat", "")
A_date<-c("12-08-2020","20-06-2018","01-01-2015","10-07-2021","20-06-2018","15-08-2019","05-08-2013","20-06-2010","15-11-2016","22-03-2022","15-05-2019")
Mydata<-data.frame(Animal, A_date)


# Issue # 1. Sanitize empty strings and spaces of different lengths and
# code them specifically as NA.

Mydata <- Mydata %>%
  mutate(Animal = gsub("^\\s*$", NA_character_, Animal))

# Convert character to datetime to sort

Mydata <- Mydata %>%
  mutate(A_date = dmy(A_date)) %>%
  arrange(A_date)

Mydata %>%
  filter(Animal %in% c("Unknow", "unknow") | is.na(Animal) | 
      !duplicated(Animal, fromLast = TRUE))
#>    Animal     A_date
#> 1     dog 2010-06-20
#> 2   horse 2013-08-05
#> 3     Dog 2015-01-01
#> 4  unknow 2016-11-15
#> 5    <NA> 2018-06-20
#> 6    Lion 2018-06-20
#> 7    <NA> 2019-05-15
#> 8  unknow 2019-08-15
#> 9  Unknow 2020-08-12
#> 10    cat 2022-03-22

Created on 2022-04-23 by the reprex package (v2.0.1)

You will have to run the code starting at the top with the raw data, as Mydata gets updated along the way.