Skip to content

Instantly share code, notes, and snippets.

View whatever's full-sized avatar
🍥
💯

Matt whatever

🍥
💯
  • インターネット総合研究所 (IRL)
  • New York, New York
  • 21:51 (UTC -05:00)
View GitHub Profile
# Divide a Data Frame or Matrix Into Subsets
# @param obj a data.frame or matrix to be split into subsets, divided by the
# categorical variable
# @param by a character-string, specifying the column to subset
# @return a list, containing the subsetted data sets. The names of the list
# correspond to the value of the subsetted list
divide <- function (obj, by) {
# Get the set of possible values
column.levels <-if (is.factor(obj[, by]))
levels(obj[, by])
@whatever
whatever / divide.R
Created January 11, 2013 16:26
Function to divide a data.frame by unique values of a column
# Divide a Data Frame or Matrix Into Subsets
# @param obj a data.frame or matrix to be split into subsets, divided by the
# categorical variable
# @param by a character-string, specifying the column to subset
# @return a list, containing the subsetted data sets. The names of the list
# correspond to the value of the subsetted list
divide <- function (obj, by) {
# Get the set of possible values
column.levels <-if (is.factor(obj[, by])) {
levels(obj[, by])
@whatever
whatever / divide-Zelig-example.R
Created January 11, 2013 16:29
Example of using divide.R with Zelig
library(Zelig)
# Divide a Data Frame or Matrix Into Subsets
# @param obj a data.frame or matrix to be split into subsets, divided by the
# categorical variable
# @param by a character-string, specifying the column to subset
# @return a list, containing the subsetted data sets. The names of the list
# correspond to the value of the subsetted list
divide <- function (obj, by) {
# Get the set of possible values
@whatever
whatever / gist:5005564
Created February 21, 2013 15:41
ERROR-SU
[02/20 20:22:17 EST] info: transport end (undefined)
[02/20 20:22:17 EST] debug: set close timeout for client AyFDdcWmLPRwzozSUGEv
[02/20 20:22:17 EST] debug: cleared close timeout for client AyFDdcWmLPRwzozSUGEv
[02/20 20:22:17 EST] debug: cleared heartbeat interval for client AyFDdcWmLPRwzozSUGEv
[02/20 20:22:17 EST] debug: discarding transport
[02/20 20:23:35 EST] debug: client authorized
[02/20 20:23:35 EST] info: handshake authorized pWWBZoxsA4GjSzYkUGEw
[02/20 20:23:35 EST] debug: setting request GET /socket.io/1/websocket/pWWBZoxsA4GjSzYkUGEw
[02/20 20:23:35 EST] debug: set heartbeat interval for client pWWBZoxsA4GjSzYkUGEw
[02/20 20:23:35 EST] debug: websocket writing 7:::1+0
@whatever
whatever / gist:5014928
Created February 22, 2013 17:02
mad funny but we know it's fake.. right? third line: Created On:15-Jan-2013 02:28:05 UTC via http://bit.ly/Xui29R SKYYYYYYNET
Domain ID:D167595099-LROR
Domain Name:WESTDUBUQUE2NDCHURCHOFCHRIST.ORG
Created On:15-Jan-2013 02:28:05 UTC
Last Updated On:15-Jan-2013 02:28:05 UTC
Expiration Date:15-Jan-2014 02:28:05 UTC
Sponsoring Registrar:GoDaddy.com, LLC (R91-LROR)
Status:CLIENT DELETE PROHIBITED
Status:CLIENT RENEW PROHIBITED
Status:CLIENT TRANSFER PROHIBITED
Status:CLIENT UPDATE PROHIBITED
@whatever
whatever / gist:5015001
Created February 22, 2013 17:08
SKYYYYYYNET
funny... but we know it's fake, right?
WHOIS via:
http://bit.ly/Xui29R
3rd line below... WESTDUBUQUE2NDCHURCHOFCHRIST.ORG created on Jan 2013
---------------
Domain ID:D167595099-LROR
Domain Name:WESTDUBUQUE2NDCHURCHOFCHRIST.ORG
Created On:15-Jan-2013 02:28:05 UTC
#instagrammer img {
border-width: 0;
border-style: solid;
border-color: black;
float: left;
margin: 0;
padding: 0;
width: 200px;
height: 200px;
-webkit-animation-name: swim-begin;
@whatever
whatever / house-etc
Created March 11, 2013 23:15
house etc
Blond:ish
http://youtu.be/hXYWc8cqF8o
http://youtu.be/gnz0t9LJb9Q
http://youtu.be/3lVKKEKaQB4
Shlohmo
http://youtu.be/pYimwWZUJS8
http://youtu.be/petLd35q5bk
Jeremy Lol (of Lol boys)
@whatever
whatever / gist:5161466
Created March 14, 2013 13:51
Example of how to make a data-time data set in R
# Create 3 date data-points
date.time1 <- as.POSIXct(strptime('2011-03-27 01:30:00', '%Y-%m-%d %H:%M:%S'))
date.time2 <- strptime("12/20/10 14.34.35", format = "%m/%d/%y %H.%M.%S")
date.time3 <- as.Date("12/15/20", format = "%m/%d/%y")
# Cast one as POSIXlt
date.posix1 <- as.POSIXlt(date.time1)
# Place dates in their columns
all.dates <- data.frame(x = date.time1, y = date.time3, z = date.time3, a = date.posix1)
@whatever
whatever / gist:5161909
Created March 14, 2013 14:45
Creates a matrix of random dates
get.random.date <- function () {
# Ignore this line... I was going to make it *ACTUALLY* do a random date,
# but we don't need this for testing... Just have 28 be an upper bound on the month
# and we don't have to worry about which month we're in or whether it's a leap year
months <- list(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
# This should determine if it's a leap year... which just changes
is.leap.year <- function (y) {
if (y %% 4 != 0)