just use GHC for OSX https://ghcformacosx.github.io
the rest of these directions are preserved for historical purposes
xcode-select --install ; brew tap homebrew/versions ; brew tap homebrew/dupes \
| # Compiled source # | |
| ################### | |
| *.com | |
| *.class | |
| *.dll | |
| *.exe | |
| *.o | |
| *.so | |
| # Packages # |
| #!/bin/sh | |
| ############################################################################## | |
| # This code known is distributed under the following terms: | |
| # | |
| # Copyright (c) 2013 Isaac (.ike) Levy <ike@blackskyresearch.net>. | |
| # All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions |
| import re | |
| import pprint | |
| import urlparse | |
| import urllib2 | |
| #http://blog.ianbicking.org/2008/12/10/lxml-an-underappreciated-web-scraping-library/ | |
| from lxml.html import parse, tostring, fromstring #for better css selectors than Beautiful Soup | |
| from lxml.html.diff import htmldiff | |
| from lxml import cssselect, etree | |
| from urlparse import urlparse | |
| from pytz import timezone |
| SELECT * | |
| FROM | |
| (SELECT | |
| month, | |
| amount, | |
| pledge_count, | |
| SUM(1) OVER(PARTITION BY month ORDER BY pledge_count DESC ROWS UNBOUNDED PRECEDING) as row | |
| FROM | |
| (SELECT | |
| TO_CHAR(CONVERT_TIMEZONE('UTC', 'America/New_York', backings.pledged_at), 'YYYY-MM-01') as month, |
just use GHC for OSX https://ghcformacosx.github.io
the rest of these directions are preserved for historical purposes
xcode-select --install ; brew tap homebrew/versions ; brew tap homebrew/dupes \
| ################################################### | |
| ## | |
| ## Functions for calculating AUC and plotting ROC | |
| ## Corey Chivers, 2013 | |
| ## corey.chivers@mail.mcgill.ca | |
| ## | |
| ################################################### | |
| ## Descrete integration for AUC calc |
| get the FileGDB API http://www.esri.com/apps/products/download/ | |
| extract it somewhere on your system and remember the path :) | |
| mkdir build #directory where we are playing around | |
| cd build | |
| git clone https://github.com/OSGeo/gdal.git | |
| cd gdal | |
| ./configure --with-fgdb=/path/to/your/FileGDB_API | |
| make | |
| (make install) optional, I'm just using it locally |
| # Speed tests of different ways to read in large numbers of CSV files | |
| # specifically read.csv.sql, read.csv (optimised) and fread | |
| library(sqldf) | |
| setwd("~/Downloads/wordcounts") | |
| files <- sample(list.files(".", pattern="*.csv|CSV$"), 10000) | |
| ############# read.csv.sql ################### | |
| system.time( |
| data_sets <- c("mtcars", "morley", "rock") | |
| shinyServer(function(input, output) { | |
| # Drop-down selection box for which data set | |
| output$choose_dataset <- renderUI({ | |
| selectInput("dataset", "Data set", as.list(data_sets)) | |
| }) | |
| # Check boxes |
| # best practices for web scraping in R # | |
| # function should be used with ldply | |
| # eg: | |
| ldply(urls, scrape) | |
| # add a try to ignore broken links/ unresponsive pages | |
| # eg: |