vendredi 8 mai 2015

F# Plot Weighted Zip Codes on US Map

I have a list of weighted Zip Codes (i.e. number of occurrences in the data) That I want to map on a US map in a heat map style. I have seen demonstrations using R in conjunction with F#.

I am new to F# and have never used R, but want to learn. What I have so far is loading R into F# and getting the data. I have created simple scatter plots and line graphs with the code below, but think it will be more appealing when mapped on a US map.

open System
open RDotNet
open RDotNet
open RProvider
open RProvider.graphics
open System.Linq
open System.Data.Linq
open Microsoft.FSharp.Data.TypeProviders
open Microsoft.FSharp.Linq
open RProvider.spatial

type dbSchema = SqlDataConnection<"Data Source=localhost;Initial Catalog=Northwind;Integrated Security=SSPI;">
let db = dbSchema.GetDataContext()

let addresses = db.Address

let zips = query {
        for row in db.Address do
        groupBy row.PostalCode into x
        select (x.Key, x.Count())
    }

Aucun commentaire:

Enregistrer un commentaire