Skip to content

Instantly share code, notes, and snippets.

View smach's full-sized avatar

Sharon Machlis smach

View GitHub Profile
install.packages("jsonlite", dependencies = TRUE)
install.packages("RCurl", dependencies = TRUE)
library("jsonlite")
library("RCurl")
base_url <- "https://api.parsely.com/v2"
apikey <- "computerworld.com"
api_secret <- "YOUR SECRET KEY"
@smach
smach / gist:e6d80c8129b94ef639c3
Created November 11, 2014 22:18
Session Info
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] splines tcltk stats graphics grDevices utils datasets methods base
other attached packages:
@smach
smach / Test.Rmd
Created November 11, 2014 22:15
Test R Markdown for rCharts graphs and tooltip problem
---
title: "Dimple Tooltip Test"
author: "Sharon Machlis"
date: "November 11, 2014"
output: html_document
---
```{r, echo=FALSE}
load("testObject.Rda")
suppressPackageStartupMessages(library(rCharts))
@smach
smach / Test.R
Created November 11, 2014 22:14
Test rCharts Dimple graph to save and then load in RMarkdownn doc
# testGraph
test <- dPlot(
mpg ~ cyl,
data = mtcars,
type = 'bubble',
width=1000,
height=600
)
@smach
smach / ProportionalElectionResults.R
Created March 27, 2014 02:18
Sample R script for finding winners in a proportional election system
# Sample R script for finding winners in a proportional election system
# by Sharon Machlis
# This example assumes a spreadsheet with a list of candidates with column headers
# Municipality, Party, Place, Name, Variable
# and a spreadsheet with a list of results with column headers
# Municipality, Red, Blue, Green (Red, Blue, Green being sample political party names)
# See sample spreadsheet format at
# https://onedrive.live.com/redir?resid=7DDBA42BF10D288B!662&authkey=!AAFnW1H3wGiZgQU&ithint=file%2c.xlsx
#!/usr/bin/env ruby
require 'mail'
#### THIS RUBY SCRIPT WAS ORIGINALLY POSTED BY blazeeboy ON GITHUB
mysql_username = 'root'
mysql_password = '123456'
mysql_database = 'test'
system("mysqldump --user=#{mysql_username} --password=#{mysql_password} #{mysql_database} > backup.sql")
@smach
smach / calc_age.r
Last active August 29, 2015 13:57 — forked from mmparker/calc_age.r
# Useful lubridate function for date subtraction written by mmparker
# Calculate age at a given reference date
# Create an interval between the date of birth and the enrollment date;
# intervals are specific to the two dates. Periods give the actual length
# of time between those dates, so convert to period and extract the year.
calc_age <- function(birthDate, refDate = Sys.Date()) {
require(lubridate)
@smach
smach / NicarLtable.html
Created August 15, 2013 17:27
Test output of googleVis
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0063)http://localhost:34035/custom/googleVis/TableID2f62c93544c.html -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TableID2f62c93544c</title>
<style type="text/css">
body {
color: #444444;
font-family: Arial,Helvetica,sans-serif;