Skip to content

Instantly share code, notes, and snippets.

View tonmcg's full-sized avatar

Tony McGovern tonmcg

View GitHub Profile
@tonmcg
tonmcg / .block
Last active August 18, 2017 00:54
Scotch Rankings
border: no
license: gpl-3.0
@tonmcg
tonmcg / .block
Last active August 18, 2017 02:07
Bayesian Statistics
border: no
license: gpl-3.0
@tonmcg
tonmcg / .block
Last active November 18, 2019 00:53
Donors Choose Using Python and DC.js
license: mit
@tonmcg
tonmcg / .block
Last active July 11, 2022 19:30
Sankey Diagram with Crossfilter
border: no
height: 600
license: gpl-3.0
@tonmcg
tonmcg / .block
Last active November 6, 2018 06:17
Zoomable Choropleth with Crossfilter
border: no
license: gpl-3.0
@tonmcg
tonmcg / .block
Last active December 11, 2017 16:48
Africa Choropleth Map
border: no
license: gpl-3.0
@tonmcg
tonmcg / Html.GetImages.pq
Last active January 4, 2018 22:29
M Language Helper Functions for HTML Parsing
let GetImages =
(url as text) =>
let
Protocol = Uri.Parts(url)[Scheme],
PathName = Uri.Parts(url)[Path],
Host = Uri.Parts(url)[Host],
Source = Text.From(Text.FromBinary(Web.Contents(url))),
GetTag = (Counter as number) =>
let
CurrentTag = Text.BetweenDelimiters(Text.BetweenDelimiters(Source, "<img", ">", Counter), "src=""", """"),
@tonmcg
tonmcg / Html.GetTables.pq
Last active May 14, 2018 19:13
M Language Helper Functions for HTML Parsing
let GetTables =
(url as text) =>
let
DOM = Text.FromBinary(Web.Contents(url)),
DOCTYPE =
let
DOCTag = "<!" & Text.BetweenDelimiters(DOM, "<!", ">") & ">"
in
DOCTag,
HTMLOpeningTag =
@tonmcg
tonmcg / tidytext_wordclouds.R
Created March 9, 2018 15:53 — forked from sfirke/tidytext_wordclouds.R
Make wordclouds from a text column in R
library(pacman)
p_load(tidytext, wordcloud, janeaustenr, dplyr)
data("stop_words")
ppdf <- data.frame(prideprejudice, stringsAsFactors = FALSE)
# create a word cloud
create_word_cloud <- function(dat, col_name, exclude = "", max.words = 50, colors = "#034772", ...){
col <- deparse(substitute(col_name))
dat %>%
@tonmcg
tonmcg / Table.Imputer.pq
Last active March 15, 2018 01:17
M Language Data Processing Functions
let Table.Imputer =
(table as table, columnName as text, strategy as text, optional axis as number) as table =>
let
InputTable = Table.AddIndexColumn(table, "index", 0, 1),
imputeList =
let
list = Table.Column(InputTable,columnName)
in
list,
imputeColumn =