Skip to content

Instantly share code, notes, and snippets.

@Princenuel
Forked from seankross/bin_op.R
Created November 7, 2018 07:31
Show Gist options
  • Save Princenuel/a0c8d0cd31cac94a88c4e1c657281a1f to your computer and use it in GitHub Desktop.
Save Princenuel/a0c8d0cd31cac94a88c4e1c657281a1f to your computer and use it in GitHub Desktop.
Swirl R Programming Script Answers
"%p%" <- function(left, right){
paste(left, right)
}
boring_function <- function(x) {
x
}
evaluate <- function(func, dat){
func(dat)
}
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.")
}
my_mean <- function(my_vector) {
sum(my_vector)/length(my_vector)
}
remainder <- function(num, divisor = 2) {
num %% divisor
}
telegram <- function(...){
paste("START", ..., "STOP")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment