Skip to content

Instantly share code, notes, and snippets.

View ncarchedi's full-sized avatar

Nick Carchedi ncarchedi

  • Datafold
  • Denver, CO
View GitHub Profile
@ncarchedi
ncarchedi / sounds.r
Created November 2, 2013 13:56 — forked from pschulam/sounds.r
# Script to help understanding of S3 object-oriented programming
# in R using classes and methods
# Constructor functions for various classes of animal
pig <- function() structure(list(), class=c("pig", "animal"))
dog <- function() structure(list(), class=c("dog", "animal"))
cat <- function() structure(list(), class=c("cat", "animal"))
makeSound <- function(x) UseMethod("makeSound")
@ncarchedi
ncarchedi / frndly.r
Created October 12, 2013 15:12 — forked from hadley/frndly.r
# 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
#