Coder Social home page Coder Social logo

goyav's Introduction

Tutorial: the goyav package

Antonin Vidon 10/29/2021

Installation

The package is located on my GitHub. From the RStudio IDE, You should install it with the devtools library using the following lines of code.

# install 'devtools'
install.packages("devtools")

# import 'devtools'
library(devtools)

# install 'goyav' from github
install_github("anvdn/goyav")
# import 'goyav'
library(goyav)

You may have to upgrade some of your packages in order to successfully install goyav.

The goyav package

Description

goyav is a shiny App meant to generate GIF from tabular temporal data. All customization of the animated plots is done in an interactive window.

The dashboard of the application looks like this :

The user is able to navigate into two tabs : “Animate” and “Advanced animate”, the latter offering a wider range of customization.

From the Animate tab, you may choose the following :

  • X variable (numeric);
  • Y variable (numeric);
  • size variable (numeric);
  • color variable (factor);
  • temporal variable (numeric);
  • choose if you want to apply a log-scale to either X, Y or X and Y.

From the Advanced animated tab, you may choose the following :

  • X variable (numeric);
  • Y variable (numeric);
  • size variable (numeric);
  • color variable (factor);
  • temporal variable (numeric);
  • choose if you want to apply a log-scale to either X, Y or X and Y.
  • X range;
  • Y range;
  • Temporal range;
  • Animation duration (s);
  • Factors to include (for the color variable).

Demonstration

In order to better show the use of the package, we will import and use the gapminder dataset from the gapminder package.

# install `gapminder`
install.packages("gapminder")
# load `gapminder`
library(gapminder)

# display first rows of dataset
knitr::kable(head(gapminder))
country continent year lifeExp pop gdpPercap
Afghanistan Asia 1952 28.801 8425333 779.4453
Afghanistan Asia 1957 30.332 9240934 820.8530
Afghanistan Asia 1962 31.997 10267083 853.1007
Afghanistan Asia 1967 34.020 11537966 836.1971
Afghanistan Asia 1972 36.088 13079460 739.9811
Afghanistan Asia 1977 38.438 14880372 786.1134

In order to be able to create any GIF, your dataframe should have candidate columns for the following variables: X, Y, size and temporal. Therefore, calling the goyav function on a dataframe with less than 4 numeric variables will return an error.

# try to call the `goyav` function on the first 3 columns of the `gapminder` dataset
goyav(gapminder[,1:3])
## Error in goyav(gapminder[, 1:3]): Your dataframe should have at least 4 numeric variables.

Let’s now call goyav on the whole dataset :

# call `goyav` on `gapminder`
goyav(gapminder)

View from the Animate tab

View from the Advanced animate tab

goyav's People

Contributors

anvdn avatar

Watchers

 avatar

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.