1
 df <- read.csv ('https://raw.githubusercontent.com/ulklc/covid19- 
 timeseries/master/countryReport/raw/rawReport.csv',
            stringsAsFactors = FALSE)
 df6 <- aggregate(recovered ~ region, subset(df), sum)

I calculated the number of regions recovered.

How do I create a line chart of this data.

1
  • What exactly do you want as output? Some kind of barplot(df6$recovered, names.arg=df6$region)? Commented May 23, 2020 at 22:28

2 Answers 2

1

If you want a line plot, you should probably keep the day variable.

df$day <- as.Date(df$day)
df6 <- aggregate(recovered ~ day+region, data=df, FUN=sum)

library(ggplot2)
ggplot(df6, aes(day, recovered, col=region)) +
  geom_line()

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

Data:

df <- read.csv('https://raw.githubusercontent.com/ulklc/covid19-timeseries/master/countryReport/raw/rawReport.csv', stringsAsFactors = FALSE)
df6 <- aggregate(recovered ~ region, subset(df), sum)

Plot in base R:

barplot(df6$recovered, names.arg=df6$region)

Plot using tidyverse:

library(tidyverse)
df6 %>% ggplot(aes(region, recovered)) + geom_col()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.