Compare commits

..

No commits in common. "fa69fe9c5f025ec077c1d6c453db54d352a23102" and "2d9aa5d1cdac25f5a92e03d8afb8f4420a66d4d7" have entirely different histories.

2 changed files with 3 additions and 19 deletions

12
main.go
View File

@ -56,7 +56,7 @@ func getConf() Config {
if err != nil {
log.Fatal("Error creating R source file: ", err)
}
_, err = of.WriteString(rCode())
_, err = of.WriteString(rCode)
if err != nil {
log.Fatal("Error writing R source code: ", err)
}
@ -99,16 +99,6 @@ func fetch() {
log.Printf("Length differs: body = %d", len(body))
conf.Len = int64(len(body))
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)
cmd := exec.Command("R", "--no-save", "-f", path.Join(confDir, "c.R"))
log.Printf("Running R")

View File

@ -1,11 +1,6 @@
package main
import (
"path"
)
func rCode() string {
return `
var rCode string = `
library(tidyverse)
library(ggplot2)
library(gridExtra)
@ -15,7 +10,7 @@ gc()
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 <- transmute(d, date=mdy(d$'Test Date'), county=County, name=name, value=value)
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$date <- mdy(zip$date)
`
}