Last active
December 30, 2015 10:09
-
-
Save forki/7813579 to your computer and use it in GitHub Desktop.
Trying the Gettysburg example from RInRuby - see https://sites.google.com/a/ddahl.org/rinruby-users/example-gettysburg-address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I "../packages/FSharp.Charting.0.90.5" | |
#I "../packages/Deedle.0.9.12" | |
#I "../packages/RProvider.1.0.5/" | |
#load "FSharp.Charting.fsx" | |
#load "Deedle.fsx" | |
#load "RProvider.fsx" | |
open System | |
open System.IO | |
open Deedle | |
open FSharp.Charting | |
open RProvider.graphics | |
open RDotNet | |
let words = | |
Path.Combine(__SOURCE_DIRECTORY__,"gettysburg.txt") | |
|> File.ReadAllText | |
|> fun text -> text.ToLower().Split() | |
|> Series.ofValues | |
let frame = | |
["Words" => words] | |
|> Frame.ofColumns | |
|> Frame.groupRowsByString "Words" | |
|> Frame.countLevel fst | |
|> Frame.filterRowValues (fun row -> row.GetAs<int> "Words" >= 3) | |
|> Frame.filterRows (fun row _ -> row.Length >= 4) | |
R.barplot(frame) // throws System.Exception: No converter registered for type Deedle.Frame`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] or any of its base types |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Datasource can be found at https://sites.google.com/a/ddahl.org/rinruby-users/example-gettysburg-address/gettysburgtxt