Need to create a plot with two data set and now getting an error message as "Error: Invalid input: date_trans works with objects of class Date only"
details are given bellow, how can I solve this issue? Thank you
Codes
ggplot()+
#red
geom_point(data=Nordstrom1, aes(x=DateSale, y=SalePricePSF))+
geom_smooth(data=Nordstrom1, method = "lm", formula = y~poly(x,1), se = F) +
geom_smooth(data=Nordstrom1, method = "lm", formula = y~poly(x,3), se = F, color = "red") +
#green
geom_point(data=NordstromSalesST, aes(x=DateSaleT, y=SalePricePSFT))+
geom_smooth(data=NordstromSalesST, method = "lm", formula = y~poly(x,3), se = F, color = "green")+
theme_economist() +
coord_cartesian(ylim = c(0, 500)) +
theme_bw()+
labs(title = "Market Selection and Price Trend Retail", x = "Sale Date", y = "Sale Price Per SF")
Nordstrom1
A tibble: 10 × 6
Sale DateSale Anchor Center SalePricePSF Overal…¹
1 2 2009-09-01 Kohl's South Bay Galleria 208. NA
2 6 2010-07-01 Kohl's Elk Grove Commons 239. 7.71
3 20 2011-05-01 Kohl's Capitola Mall 380 6.58
4 24 2011-08-01 Kohl's Parkway Plaza 248. NA
5 25 2011-09-01 JCPenny lhe Village At Orange 105. 6.02
6 37 2012-05-01 Forever 2 i The at Montebello 249. 6.29
7 42 2012-08-01 Walmart La Habra 160. 5.61
8 55 2012-12-01 Kohl's The Crossroads At Pleasant Hill 371. 6.75
9 66 2013-11-01 Kohl's South Bay Galleria 354. 5.26
10 70 2014-02-01 Target Northwood Square 152. 6.1
NordstromSalesST
A tibble: 6 × 4
Address DateSaleT SalePricePSFT PriceSaleT
1 800 Coddingtown Ctr 2005-11-21 00:00:00 105. 10562045
2 900 Coddingtown Ctr 2005-11-21 00:00:00 105. 7882123
3 1363 N Mcdowell Blvd 2017-04-13 00:00:00 186. 16416907
4 8270 Petaluma Hill Rd 2015-04-03 00:00:00 10.8 1200000
5 311 Rohnert Park Expy W 2022-06-24 00:00:00 164. 14000000
6 100 Santa Rosa Plz 2015-07-06 00:00:00 180. 12829406