Created
October 30, 2017 11:56
-
-
Save tomhopper/16dd2b7966c5f73172fbbf588710158b to your computer and use it in GitHub Desktop.
Programmatically access data provided by packages in R
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
## Access data provided by packages | |
## List all available data sets, plus ancillary information #### | |
the_data <- data() | |
## Extract just the packages as a data frame #### | |
the_data_df <- data.frame(the_data$results, stringsAsFactors = FALSE) | |
## Extract specific data sets #### | |
specific_data <- get(the_data_df$Item[1]) | |
specific_data <- get(the_data_df$Item[2]) | |
specific_data <- get(the_data_df$Item[the_data_df$Item == "women"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment