Skip to content

Instantly share code, notes, and snippets.

@bhive01
Created September 30, 2017 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhive01/96eebe1e8dda71046157ce485d578ef1 to your computer and use it in GitHub Desktop.
Save bhive01/96eebe1e8dda71046157ce485d578ef1 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(GGally)
nba = read.csv("http://datasets.flowingdata.com/ppg2008.csv")
nba1 <-
sample_n(nba, 40) %>%
as_tibble() %>%
mutate(league = 1)
nba2 <-
sample_n(nba, 40) %>%
as_tibble() %>%
mutate(league = 2)
nba3 <-
sample_n(nba, 40) %>%
as_tibble() %>%
mutate(league = 3)
nbaexample <-
bind_rows(nba1, nba2, nba3) %>%
group_by(league) %>%
nest() %>%
mutate(plot = map(data, function(x) ggcorr(x, label = TRUE, label_alpha = TRUE)))
walk(nbaexample$plot, function(x) print(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment