RamiKrispin / coronavirus_dashboard

The Coronavirus Dashboard
https://ramikrispin.github.io/coronavirus_dashboard/
108 stars 133 forks source link

Error: Assigned data #15

Closed digitalanalogboy closed 3 years ago

digitalanalogboy commented 4 years ago

Hi,

I want to try the dashboard. When i run it on R studio i got this error

------------trajectory plot data prep------------

df_china <- coronavirus %>% dplyr::filter(type == "confirmed", Country.Region == "China") %>%

  • dplyr::group_by(date) %>%
  • dplyr::summarise(cases = sum(cases)) %>%
  • dplyr::ungroup() %>%
  • dplyr::arrange(date) %>%
  • dplyr::mutate(china = cumsum(cases)) %>%
  • dplyr::filter(china > 100) %>%
  • dplyr::select(-cases, -date) df_china$index <- 1:nrow(df_china) Error: Assigned data 1:nrow(df_china) must be compatible with existing data. x Existing data has 0 rows. x Assigned data has 2 rows. ℹ Only vectors of size 1 are recycled.

can you help me?

RamiKrispin commented 4 years ago

Hi @digitalanalogboy

Sorry for the late response, just now saw your issue.

Not sure why you are not able to reproduce the plot, but I created a function that simplifies the process and creates a trajectory plot based on country names, min number of cases and number of days since the number of cases surpass the min number of cases: https://gist.github.com/RamiKrispin/4487739b41d9d4d8848cf93366404cf2

Please let me know if this solve your issue or not. Please note that you need (until version 0.2.0 will be on CRAN) to install the Github version of the package using:

devtools::install_github("RamiKrispin/coronavirus")

Rami