我想在 r 上制作一张地图,并通过颜色的强度显示价格弹性。这是我使用线性回归得到的数据:
IN log_PRICE -1.1059770 0.05943414 -18.60845 7.186435e-72
KY log_PRICE -1.0459502 0.03410250 -30.67078 2.739798e-196
OH log_PRICE -0.9076732 0.01259117 -72.08806 0.000000e+00
TX log_PRICE -0.2252409 0.01053847 -21.37321 4.117490e-101
IN log_PRICE -1.1059770 0.05943414 -18.60845 7.186435e-72
KY log_PRICE -1.0459502 0.03410250 -30.67078 2.739798e-196
OH log_PRICE -0.9076732 0.01259117 -72.08806 0.000000e+00
TX log_PRICE -0.2252409 0.01053847 -21.37321 4.117490e-101
library(usmap)
library(ggplot2)
library(tmpa)
library(sf)
library(leaflet)
plot_usmap(regions="state", data = CC1, values = "estimate",
include = c("IN", "KY", "OH", "TX"), color = "orange") +
scale_fill_continuous(low = "white", high = "orange",
name = "Price elasticity", label = scales::comma) +
labs(title = "Price elasticity for Cold Cereal",
subtitle = "States include: IN, KY, OH, TX") +
theme(legend.position = "right")
#That is the code I wrote but I keep getting this error
Error in match.arg(regions) : 'arg' must be NULL or a character vector