Skip to content

Instantly share code, notes, and snippets.

@AliSajid
Created March 22, 2018 15:25
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 AliSajid/dfcbde59bc217edbee4239ee9490f04d to your computer and use it in GitHub Desktop.
Save AliSajid/dfcbde59bc217edbee4239ee9490f04d to your computer and use it in GitHub Desktop.
library(tidyverse)
library(plotly)
library(broom)
data("anscombe")
round_fun <- function(value, func, precision = 2) {
round(func(value), precision)
}
clean_anscombe <- anscombe %>%
mutate(observation = seq_len(n())) %>%
gather(key, value, -observation) %>%
separate(key, c("variable", "set"), 1, convert = TRUE) %>%
mutate(set = c("A", "B", "C", "D")[set]) %>%
spread(variable, value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment