Asseming your tata are "dates
library(lubridate)
city <- structure(list(name = c("Abilene", "Akron", "Albany", "Albuquerque",
"Alexandria", "Allentown", "Amarillo", "Anaheim", "Anchorage",
"Ann Arbor", "Arden-Arcade", "Arlington", "Arlington", "Arvada",
"Athens-Clarke County", "Atlanta", "Augusta-Richmond County",
"Aurora", "Aurora", "Austin"), pop = c(115930L, 217074L, 93994L,
448607L, 128283L, 106632L, 173627L, 328014L, 260283L, 114024L,
92040L, 332969L, 174838L, 102153L, 101489L, 416474L, 199775L,
276393L, 142990L, 656562L), ddate = structure(c(18262, 18263,
18264, 18265, 18266, 18267, 18268, 18269, 18270, 18271, 18272,
18273, 18274, 18275, 18276, 18277, 18278, 18279, 18280, 18281
), class = "Date")), row.names = c(NA, 20L), class = "data.frame")
library(lubridate)
city$ddate <- seq(ymd("2020/01/01"), ymd("2020-01-20"), by = "day")
dat1 <- subset(city, ddate < ymd("2020/01/15") | ddate > ymd("2020/01/18"))
dat1