Comment

Comment by rnadna

In case it's of any interest, below is code in the R language that produces time-series graphs for two provinces in Canada.

    fluPlot <- function(country="ca", regions="Nova.Scotia")
    {
        url <- sprintf("http://www.google.org/flutrends/intl/en_us/%s/data.txt", country)
        d <- read.csv(url, skip=11, header=TRUE)
        n <- length(regions)
        t <- as.POSIXct(d[["Date"]])
        for (i in 1:n) {
            if (i == 1) {
                plot(t, d[[regions[i]]], xlab="", ylab=regions[i], type='l', col=i)
                grid()
            } else {
                lines(t, d[[regions[i]]], col=i)
            }
        }
        legend("top", col=1:n, lwd=par('lwd'), legend=regions, bg='white')
    }
    par(mar=c(2, 2, 2, 2), mgp=c(2, 0.7, 0))
    fluPlot("ca", c("Ontario", "Nova.Scotia"))
parent rnadna 14 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton