-
-
Save charanhu/e36c5f1c308c99e0b7c720af91ddfbad to your computer and use it in GitHub Desktop.
Swirl R Programming Script Answers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"%p%" <- function(left, right){ | |
paste(left, right) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boring_function <- function(x) { | |
x | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
evaluate <- function(func, dat){ | |
func(dat) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_mean <- function(my_vector) { | |
sum(my_vector)/length(my_vector) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remainder <- function(num, divisor = 2) { | |
num %% divisor | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
telegram <- function(...){ | |
paste("START", ..., "STOP") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment