Compare commits
No commits in common. "fa69fe9c5f025ec077c1d6c453db54d352a23102" and "2d9aa5d1cdac25f5a92e03d8afb8f4420a66d4d7" have entirely different histories.
fa69fe9c5f
...
2d9aa5d1cd
12
main.go
12
main.go
|
@ -56,7 +56,7 @@ func getConf() Config {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error creating R source file: ", err)
|
log.Fatal("Error creating R source file: ", err)
|
||||||
}
|
}
|
||||||
_, err = of.WriteString(rCode())
|
_, err = of.WriteString(rCode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error writing R source code: ", err)
|
log.Fatal("Error writing R source code: ", err)
|
||||||
}
|
}
|
||||||
|
@ -99,16 +99,6 @@ func fetch() {
|
||||||
log.Printf("Length differs: body = %d", len(body))
|
log.Printf("Length differs: body = %d", len(body))
|
||||||
conf.Len = int64(len(body))
|
conf.Len = int64(len(body))
|
||||||
save()
|
save()
|
||||||
|
|
||||||
of, err := os.Create(path.Join(path.Dir(confFile), "rows.csv"))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("Cannot create rows.csv: ", err)
|
|
||||||
}
|
|
||||||
_, err = of.Write(body)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("Error writing rows.csv: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
confDir := path.Dir(confFile)
|
confDir := path.Dir(confFile)
|
||||||
cmd := exec.Command("R", "--no-save", "-f", path.Join(confDir, "c.R"))
|
cmd := exec.Command("R", "--no-save", "-f", path.Join(confDir, "c.R"))
|
||||||
log.Printf("Running R")
|
log.Printf("Running R")
|
||||||
|
|
10
rcode.go
10
rcode.go
|
@ -1,11 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
var rCode string = `
|
||||||
"path"
|
|
||||||
)
|
|
||||||
|
|
||||||
func rCode() string {
|
|
||||||
return `
|
|
||||||
library(tidyverse)
|
library(tidyverse)
|
||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
library(gridExtra)
|
library(gridExtra)
|
||||||
|
@ -15,7 +10,7 @@ gc()
|
||||||
|
|
||||||
options(scipen=100000)
|
options(scipen=100000)
|
||||||
|
|
||||||
d <- read_csv('`+ path.Dir(confFile) + `/rows.csv')
|
d <- read_csv('~/prog/covid/nyopendata/rows.csv')
|
||||||
d <- pivot_longer(d, c('New Positives', 'Total Number of Tests Performed'))
|
d <- pivot_longer(d, c('New Positives', 'Total Number of Tests Performed'))
|
||||||
d <- transmute(d, date=mdy(d$'Test Date'), county=County, name=name, value=value)
|
d <- transmute(d, date=mdy(d$'Test Date'), county=County, name=name, value=value)
|
||||||
queens <- subset(d, county=='Queens')
|
queens <- subset(d, county=='Queens')
|
||||||
|
@ -39,4 +34,3 @@ zip <- read_csv('~/prog/covid/nyopendata/timeseries.csv')
|
||||||
zip <- pivot_longer(zip, c('COVID_CASE_COUNT','COVID_DEATH_COUNT','TOTAL_COVID_TESTS'))
|
zip <- pivot_longer(zip, c('COVID_CASE_COUNT','COVID_DEATH_COUNT','TOTAL_COVID_TESTS'))
|
||||||
zip$date <- mdy(zip$date)
|
zip$date <- mdy(zip$date)
|
||||||
`
|
`
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user