【发布时间】:2021-01-19 18:40:54
【问题描述】:
这是代码(以前可以工作):
require('RCurl')
require(repr)
require(RCurl)
require(foreign)
require(tidyverse)
states = read.csv("https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv", sep =",",header = TRUE)
states <- states %>%
mutate(date = as.POSIXct(date, format = '%Y-%m-%d'))
last_day <- states[states$date==states$date[nrow(states)],]
with(last_day, plot(state, cases, las=2, cex.axis=.9, cex.main=1.5,
main="Confirmed cases by state",
xlab="", ylab=""))
...这是错误消息:
plot.window(...) 中的错误:需要有限的“xlim”值 另外:警告信息: 1:在 xy.coords(x, y, xlabel, ylabel, log) 中:强制引入的 NA 2:在 min(x) 中:min 没有非缺失参数;返回 Inf 3:在 max(x) 中:max 没有非缺失参数;返回 -Inf
但是不需要对数绘图;并且没有无限的价值:
> summary(last_day$cases)
Min. 1st Qu. Median Mean 3rd Qu. Max.
70 23562 86525 134731 154429 831494
【问题讨论】:
-
您需要
barplot吗?即barplot(with(last_day, tapply(cases, state, FUN = sum)))