Coder Social home page Coder Social logo

datamations's Introduction

Datamation pacakge

Installation

First, download the zip file of the package source called dmpkg_0.0.0.9007.tar.gz from this link, since the anonymous GitHub repo doesn’t allow for downloading. With the zip file you downloaded, run the code below (README.Rmd) to reproduce the datamation gifs. (eval=FALSE in chunk options might prevent you from automatically running the chuncks. Remove if necessary.)

install.packages(file.choose(), repos = NULL, type = "source")
library(datamation)
library(animation)
library(tidyverse)

Examples for Plot-based Datamations

degree_title_step1 <- "Step 1: Each dot shows one person\n            and each group shows degree type"
degree_title_step2 <- "Step 2: Next you plot the salary of each person\n            within each group"
degree_title_step3 <- "Step 3: Lastly you plot the average salary \n            of each group and zoom in"
work_degree_title_step1 <- "Step 1: Each dot shows one person and each group\n            shows degree type AND work setting"
plot_pipe <- "small_salary %>% group_by(Degree) %>% summarize(mean = mean(Salary))"

# The command below takes 70 seconds to execute on my machine
datamation_sanddance(plot_pipe, output = "mean_salary_group_by_degree.gif",
                     titles = c(degree_title_step1, degree_title_step2, degree_title_step3), 
                     nframes = 30)

plot_pipe2 <- "small_salary %>% group_by(Degree, Work) %>% summarize(mean = mean(Salary))"

# The command below takes 15 seconds to execute on my machine
datamation_sanddance(plot_pipe2, output = "mean_salary_group_by_degree_work.gif",
                     titles = c(work_degree_title_step1, degree_title_step2, degree_title_step3))

Examples for Table-based Datamations

# The command below takes 20 seconds to execute on my machine
pipeline <- "small_salary_data %>% group_by(Degree)"
dmpkg::datamation_tibble(pipeline, output = "salary_group_degree.gif")

# The command below takes 40 seconds to execute on my machine
pipeline <- "mtcars %>% group_by(cyl)"
dmpkg::datamation_tibble(pipeline, output = "mtcars_group_cyl.gif")

# The command below takes 50 seconds to execute on my machine
pipeline <- "small_salary_data %>% group_by(Degree, Work) %>% summarize(Avg_Salary = mean(Salary))"
dmpkg::datamation_tibble(pipeline, output = "salary_group2_summarize_mean.gif")

# The command below takes 50 seconds to execute on my machine
pipeline <- "small_salary_data %>% group_by(Degree, Work) %>% summarize(Avg_Salary = mean(Salary))"
dmpkg::datamation_tibble(pipeline, output = "salary_group2_summarize_mean.gif",
                         titles = c("Grouping by Degree and Work", 
                                    "Calculating the Mean of Each Group"))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.