Giter Club home page Giter Club logo

gdiviz's Introduction

gdiviz

Under construction

This package is a collection of data and tools that allows for the easy production of charts.

Installation

# install.packages("devtools")
devtools::install_github("ksreyes/gdiviz")

Getting started

The key function of this package is gdiplot(), which generates a ggplot chart from a list of chart templates. It requires two arguments: code, which determines the variable and chart type to be created, and country, which is the 3-letter ISO code of the country to chart.

library(gdiviz)
gdiplot(code = "stocks", country = "DEU")

gdiplot(code = "popmap", country = "DEU")

gdiplot(code = "idp", country = "DEU")

To see the list of available charts and their respective codes, run gdiplots. Charts can be exported as SVG or PNG files with the export argument. See ?gdiplot for more information on this and other arguments.

The underlying data are bundled with this package and are available to users. Run gdidata to see the list. To check data availability for a country, run check_data(iso), where iso is the 3-letter ISO code.

Datasets are indexed by ISO codes. For the user’s convenience, countryname() can be used to look up the corresponding country name. For example, countryname("DEU") returns “Germany”. The reverse is also possible, with countryname("Germany", from = "name", to = "iso3c") returning “DEU”. Alternatively, run countrynames to see the full list of countries.

Advanced usage

The function apply_theme() can be used to apply IOM theming to any ggplot chart. For example:

library(ggplot2)
library(gdiviz)

iris |>
  dplyr::summarise(Sepal.Length = mean(Sepal.Length), .by = Species) |>
  ggplot(aes(x = Species, y = Sepal.Length)) +
  geom_bar(stat = "identity", fill = pal("blues")) +
  ggtitle("The iris dataset") +
  apply_theme("bar-vertical")

Default sizes are optimized for export as an image with width 12 cm at 300 dpi. IOM color palettes are also available using pal(). See function documentation for details.

Disclaimer

I wrote this package to make my job easier. Nothing here has the official endorsement of my employer.

gdiviz's People

Contributors

ksreyes 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.