---
title: "Covid-19"
author: "Jeff Kinne"
date: "March 12, 2020"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Covid-19 Analysis

This data came from https://github.com/CSSEGISandData/COVID-19
**This is bold**

```{r}
setwd("~/Downloads/")
confirmed <- read.csv("time_series_19-covid-Confirmed.csv")

# pick a country
region <- 2 # challenge - have the code get the index based on a country string
data <- confirmed[region, 5:ncol(confirmed)]

# only for days at least 10
indexes <- which(data >= 10)
first_index <- indexes[1]
data_10 <- data[first_index:length(data)]

# plot
plot(1:length(data_10), log(data_10))
```

```{r}
# Challenge: US - determine rows that are US, colSums to add them up to get one row of US.  And also using $ and ==

# Challenge: make a prediction 
#           - look at the log plot to see which days in a row have the same growth
#           - use those days and log(data) with lm function - linear model
#           - use predice function with the result of the linear model to predict

# Challenge: 
data_10_new <- data_10[-1] - data_10[-length(data_10)]
plot(1:length(data_10_new), data_10_new)
```
