Here is the code
covid <- read.csv(file = 'covid_au_state.csv')
dput(covid)
library(lubridate)
library(dplyr)
library(ggplot2)
covid %>%
mutate(date = dmy(date))
group_by(date) %>%
summarize(confirmed_cum = sum(confirmed_cum)) %>%
ggplot(aes(x =confirmed_cum , y = date)) +
geom_point(aes(color = confirmed)) +
labs(x = 'Confirmed cases', y = 'date',
title = 'Number of new confirmed cases daily throughout Australia')
I am getting an error:
> covid <- read.csv(file = 'covid_au_state.csv')
> dput(covid)
structure(list(date = c("25/01/2020", "26/01/2020", "27/01/2020"
), confirmed_cum = c(4L, 4L, 5L)), class = "data.frame", row.names = c(NA,
-3L))
> library(lubridate)
> library(dplyr)
> library(ggplot2)
> covid %>%
+ mutate(date = dmy(date))
date confirmed_cum
1 2020-01-25 4
2 2020-01-26 4
3 2020-01-27 5
> group_by(date) %>%
+ summarize(confirmed_cum = sum(confirmed_cum)) %>%
+ ggplot(aes(x =confirmed_cum , y = date)) +
+ geom_point(aes(color = confirmed)) +
+ labs(x = 'Confirmed cases', y = 'date',
+ title = 'Number of new confirmed cases daily throughout Australia')
Error in UseMethod("group_by_") :
no applicable method for 'group_by_' applied to an object of class "function"
> covid <- read.csv(file = 'covid_au_state.csv')
> dput(covid)
structure(list(date = c("25/01/2020", "26/01/2020", "27/01/2020"
), confirmed_cum = c(4L, 4L, 5L)), class = "data.frame", row.names = c(NA,
-3L))
> library(lubridate)
> library(dplyr)
> library(ggplot2)
> covid %>%
+ mutate(date = dmy(date))
date confirmed_cum
1 2020-01-25 4
2 2020-01-26 4
3 2020-01-27 5
> group_by(date) %>%
+ summarize(confirmed_cum = sum(confirmed_cum)) %>%
+ ggplot(aes(x =confirmed_cum , y = date)) +
+ geom_point(aes(color = confirmed)) +
+ labs(x = 'Confirmed cases', y = 'date',
+ title = 'Number of new confirmed cases daily throughout Australia')
Error in UseMethod("group_by_") :
no applicable method for 'group_by_' applied to an object of class "function"