首页 > 解决方案 > seq.int(0, to0 - from, by) : 'to' 必须是有限数

问题描述

我有一个项目,我有 error = "error in seq.int(0, to0 - from, by) : 'to' must be afinite number" 这是代码。大家能帮忙吗?

library(ggplot2)
library(dplyr)
library(plyr)
library(tidyverse)
library(DataExplorer)
library(ggrepel)

raw_data = mutate(raw_data, Date.Announced= as.Date(Date.Announced, format="%d/%m/%y"))
raw_data = raw_data[order(as.numeric(raw_data$Date.Announced)),]

daily_rate = raw_data[,c("Date.Announced" , "Patient.Number")]
count_daily = count(daily_rate,"Date.Announced")
count_daily

ggplot(count_daily, aes(x=Date.Announced, y=freq)) +
  geom_segment( aes(x=Date.Announced, xend=Date.Announced, y=0, yend=freq),
                color="red") +
  geom_point( color="orange", size=1) +
  theme_light() +
  scale_x_date(date_breaks = "1 week",date_labels = "%d %b")+
  theme(
    panel.grid.major.x = element_blank(),
    panel.border = element_blank(),
    axis.ticks.x = element_blank()
  ) +
  xlab("") +
  labs(title = "Daily Increase in the Number of Patients")+
  ylab("Number of patients")

我知道这是与日期格式有关的错误,但我不知道如何解决它。

标签: r

解决方案


推荐阅读