I am trying to make a subset based on date conditions. I uploaded a dataset and tried to convert the date from POSIXct to a date class using this code:
as.Date(weatherDump$date, "%Y-%m-%d")
It seemed to convert the date to y/m/d but when I try and run the subset I get an error:
weather2013to2018 <- subset(weatherDump, date >= "2013-01-01" & date<= "2017-12-31")
Warning messages:
1: In Ops.factor(date, "2013-01-01") : ‘>’ not meaningful for factors
2: In Ops.factor(date, "2017-12-31") : ‘<’ not meaningful for factors
when I check the class(date) it is Function.
I presume I have gone wrong on the date conversion?