Skip to content

Instantly share code, notes, and snippets.

@Maddocent
Forked from seankross/bin_op.R
Last active August 29, 2015 14:24

Revisions

  1. @seankross seankross created this gist Mar 21, 2015.
    3 changes: 3 additions & 0 deletions bin_op.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    "%p%" <- function(left, right){
    paste(left, right)
    }
    3 changes: 3 additions & 0 deletions boring_function.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    boring_function <- function(x) {
    x
    }
    3 changes: 3 additions & 0 deletions evaluate.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    evaluate <- function(func, dat){
    func(dat)
    }
    12 changes: 12 additions & 0 deletions mad_libs.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    mad_libs <- function(...){
    # Do your argument unpacking here!
    args <- list(...)
    place <- args[["place"]]
    adjective <- args[["adjective"]]
    noun <- args[["noun"]]

    # Don't modify any code below this comment.
    # Notice the variables you'll need to create in order for the code below to
    # be functional!
    paste("News from", place, "today where", adjective, "students took to the streets in protest of the new", noun, "being installed on campus.")
    }
    3 changes: 3 additions & 0 deletions my_mean.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    my_mean <- function(my_vector) {
    sum(my_vector)/length(my_vector)
    }
    3 changes: 3 additions & 0 deletions remainder.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    remainder <- function(num, divisor = 2) {
    num %% divisor
    }
    3 changes: 3 additions & 0 deletions telegram.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    telegram <- function(...){
    paste("START", ..., "STOP")
    }