-1

It says that the error is in the "library(ggplot2)" line and I don't know how to fix it. Here's the code I was using:

library(ggplot2)

library('remotes')
remotes::install_github("GuangchuangYu/nCov2019", dependencies = TRUE)

library('nCov2019')
get_nCov2019(lang = 'en')

library(dplyr)
library(magrittr)

d <- y['global'] 
f <- d %>% dplyr::filter(time == time(y)) %>% top_n(180, cum_confirm) %>% arrange(desc(cum_confirm)) 

library(ggrepel)

library(dplyr)

require(ggplot2)
require(ggrepel)
ggplot(filter(d, d$time > '2020-02-05' & country %in% f$country), mapping = aes(time, cum_confirm , color = country, label = country))  +
geom_line() +
  geom_text(data = f, aes(label = country, colour = country, x = time, y = cum_confirm))+
theme_minimal(base_size = 14)+
theme(legend.position = "none") +
ggtitle('Covid-19 Cases by Country', 'The progression of confirmed cases by countries')+
ylab('Confirmed Cases')

The graph seems about right when I run the chunk, but I also get the following message and I don't know what does that mean: "Removed 1 rows containing missing values (geom_text)."

1 Answers1

0

Don't worry, the message should only be a "warning", it is because in the data vector that ggplot is receiving it has found one (or more than one) element of type NA. This is common in ggplot, it is not like the mean function, in which you have to specify a second argument like na.rm

robintux
  • 93
  • 1
  • 9