Created
October 31, 2011 21:52
-
-
Save ajdamico/1329117 to your computer and use it in GitHub Desktop.
roger peng's listlabeling challenge
This file contains hidden or 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
#roger peng's listlabeling challenge from | |
#http://simplystatistics.tumblr.com/post/11988685443/computing-on-the-language | |
#create three example variables for a list | |
x <- 1 | |
y <- 2 | |
z <- "hello" | |
#create the function | |
makeList <- function(...) { | |
#put all values into a list | |
argument_values <- list(...) | |
#save all the objects available in the environment into the names vector, | |
#excluding the first, which is the makeList function itself | |
names(argument_values) <- as.list(sys.call())[-1] | |
#return the newly-labeled function | |
argument_values | |
} | |
#display the results | |
makeList( x , y , z ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment