Giter Club home page Giter Club logo

coronavirus's People

Contributors

sbs87 avatar

Watchers

 avatar

coronavirus's Issues

Add population data for non US cities/regions

Add population data for non US cities/regions

# TODO Add population data for non US cities/regions


##------------------------------------------
## Add population and lat/long data (CURRENTLY US ONLY)
##------------------------------------------
# TODO Add population data for non US cities/regions
kable(filter(metadata,(is.na(Country.Region) | is.na(Population) )) %>% select(c("Country.Region","Province.State","City")) %>% unique(),caption = "Regions for which either population or Country is NA")

# Drop missing data 
metadata<-filter(metadata,!(is.na(Country.Region) | is.na(Population) ))
# Convert remaining pop to numeric
metadata$Population<-as.numeric(metadata$Population)

# Add metadata to cases
Corona_Cases<-merge(Corona_Cases,metadata,all.x = T)

##------------------------------------------
## Compute total and death cases relative to population 
##------------------------------------------

Corona_Cases$Total_confirmed_cases.per100<-100*Corona_Cases$Total_confirmed_cases/Corona_Cases$Population
Corona_Cases$Total_confirmed_deaths.per100<-100*Corona_Cases$Total_confirmed_deaths/Corona_Cases$Population


##------------------------------------------
## Filter df for US state-wide stats
##------------------------------------------

Corona_Cases.US_state<-filter(Corona_Cases,Country.Region=="US_state" & Total_confirmed_cases>0 ) 
kable(table(select(Corona_Cases.US_state,c("Province.State"))),caption = "Number of longitudinal datapoints (total/death) per state")
Corona_Cases.US_state<-merge(Corona_Cases.US_state,ddply(filter(Corona_Cases.US_state,Total_confirmed_cases>100),c("Province.State"),summarise,case100_date_state=min(Date.numeric)))
Corona_Cases.US_state$Days_since_100_state<-Corona_Cases.US_state$Date.numeric-Corona_Cases.US_state$case100_date_state


ANALYSIS

Add death rate data

  1. Need to add death rate data to plots and how it tracks with total cases.
  2. Need to add prediction similar to total cases

Daily notation

I can't tell if you have updated the graph day to day because I can't tell what the last day is on the chart. If you could put the day notation at the bottom of the graph that might be helpful.

Add population data for non US cities/regions

Add population data for non US cities/regions

https://github.com/sbs87/coronavirus/blob/206dd8e52162b1a4f3f67e3f1c13e31093a01110/Corona_Prediction.html#L1465


##------------------------------------------
## Add population and lat/long data (CURRENTLY US ONLY)
##------------------------------------------
# TODO Add population data for non US cities/regions
kable(filter(metadata,(is.na(Country.Region) | is.na(Population) )) %&gt;% select(c(&quot;Country.Region&quot;,&quot;Province.State&quot;,&quot;City&quot;)) %&gt;% unique(),caption = &quot;Regions for which either population or Country is NA&quot;)</code></pre>
<table>
<caption>Regions for which either population or Country is NA</caption>
<thead>
<tr class="header">
<th align="left">Country.Region</th>
<th align="left">Province.State</th>
<th align="left">City</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<pre class="r"><code># Drop missing data 
metadata&lt;-filter(metadata,!(is.na(Country.Region) | is.na(Population) ))
# Convert remaining pop to numeric
metadata$Population&lt;-as.numeric(metadata$Population)</code></pre>
<pre><code>## Warning: NAs introduced by coercion</code></pre>
<pre class="r"><code># Add metadata to cases
Corona_Cases&lt;-merge(Corona_Cases,metadata,all.x = T)

##------------------------------------------
## Compute total and death cases relative to population 
##------------------------------------------

Corona_Cases$Total_confirmed_cases.per100&lt;-100*Corona_Cases$Total_confirmed_cases/Corona_Cases$Population
Corona_Cases$Total_confirmed_deaths.per100&lt;-100*Corona_Cases$Total_confirmed_deaths/Corona_Cases$Population


##------------------------------------------
## Filter df for US state-wide stats
##------------------------------------------

Corona_Cases.US_state&lt;-filter(Corona_Cases,Country.Region==&quot;US_state&quot; &amp; Total_confirmed_cases&gt;0 ) 
kable(table(select(Corona_Cases.US_state,c(&quot;Province.State&quot;))),caption = &quot;Number of longitudinal datapoints (total/death) per state&quot;)</code></pre>
<table>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.