Skip to content

Instantly share code, notes, and snippets.

View ramnathv's full-sized avatar

Ramnath Vaidyanathan ramnathv

View GitHub Profile
@nitingupta2
nitingupta2 / netlify_deploy.md
Last active August 15, 2017 00:33
Deploy a blogdown website on Netlify

Assuming you have:

  1. A website built using blogdown and Hugo
  2. Hosted on GitHub pages, a.k.a .github.io
  3. Built your blogdown website on your local machine blogdown:::serve_site(), which is generated within the public folder
  4. Sync'd your local public repository to .github.io repository in your github account

You want to deploy your website to Netlify, which supports custom domains with HTTPS:

  1. Sign up on Netlify with your GitHub account.
@diegovalle
diegovalle / diet.r
Created March 9, 2010 17:18
Cluster analysis of what the world eats
########################################################
##### Author: Diego Valle Jones
##### Website: www.diegovalle.net
##### Date Created: Mon Mar 01 18:51:27 2010
########################################################
#1. For what foods are Americans and Mexicans outliers
#2. Partition the data around medoids to classify the
#countries of the world according to what they eat
library(ggplot2)
@mbostock
mbostock / .block
Last active January 13, 2017 19:31
ggplot2-Style Axis
license: gpl-3.0
@mmparker
mmparker / README.md
Created September 7, 2012 23:25
Table-driven plot in d3.js

Best viewed in its own window (because I haven't set up the CSS properly yet).

This is a report to enable my clinicians to easily review clinic statistics at will. Click on rows in the table to plot that statistic; click again to remove it from the plot.

Very much a work in progress, so please feel free to heap on the feedback!

Built with the rampantly awesome D3.js.

@ramnathv
ramnathv / automate_ghpages.md
Created October 4, 2012 19:10
Automating Github Pages Workflow

Problem

You have git repository with the following directory structure

myproject
|- source
|- docs
|- README.md
@jennybc
jennybc / polygraphing-films.R
Created April 9, 2016 16:46
Get polygraphing's film data into R
## http://polygraph.cool/films/
## https://github.com/matthewfdaniels/scripts
x <- "https://raw.githubusercontent.com/matthewfdaniels/scripts/master/data/character_list5.csv"
characters <- read.csv(x, na.strings = c("NULL", "?"),
fileEncoding = "ISO-8859-1", stringsAsFactors = FALSE)
## some ages are clearly (negative) birth years ... oops
characters$age[!is.na(characters$age) & characters$age < 0] <- NA
characters$age[!is.na(characters$age) & characters$age > 105] <- NA
@bearloga
bearloga / tabletools.R
Created January 9, 2014 00:40
This shows how to add a DataTables plug-in (in this case TableTools) to your Shiny app.
library(shiny)
library(ggplot2)
# Download DataTables JS file and TableTools full package from http://datatables.net/download/
# Change the paths appropriately:
addResourcePath('datatables','/Users/yourusername/Downloads/DataTables-1.9.4/media')
addResourcePath('tabletools','/Users/yourusername/Downloads/TableTools-2.1.5/media')
runApp(list(
ui = basicPage(
@ramnathv
ramnathv / to_json.R
Created October 29, 2013 20:28
Data Frame to JSON ala Pandas
to_json = function(df, orient = "columns", json = T){
dl = as.list(df)
dl = switch(orient,
columns = dl,
records = do.call('zip_vectors_', dl),
values = do.call('zip_vectors_', setNames(dl, NULL))
)
if (json){
dl = rjson::toJSON(dl)
}
@hadley
hadley / frndly.r
Created September 27, 2013 20:04
# A tutorial navigates through a series of states, either manually, with
# nxt(), prv(), jmp() etc, or automatically, by using addTaskCallback() and
# checking that preconditions are met.
#
# Each state has:
# * a message
# * a next state (a function name)
# (eventually may have multiple next named states)
# * an auto test
#
@hadley
hadley / html.r
Last active December 18, 2015 03:58
# We first start by creating a way of escaping the characters that have special
# meaning for html, while making sure we don't end up double-escaping at any
# point. The easiest way to do this is to create an S3 class that allows us to
# distinguish between regular text (that needs escaping) and html (that
# doesn't).
#
# We then write an escape method that leaves html unchanged and escapes the
# special characters (&, <, >) in ordinary text. We also add a method for lists
# for convenience