Assorted Shiny apps collection, full code and data

Here is an assortment of R Shiny apps that you may find useful for exploration if you are in the process of learning Shiny and looking for something different. Some of these apps are very small and simple whereas others are large and complex. This repository provides full code and any necessary accompanying data sets. The repo also links to the apps hosted online at shinyapps.io so that you can run apps in your browser without having to download the entire collection repo to run apps locally. That and other details can be found at the repo linked above. This isn’t a tutorial or other form of support, but it’s plenty of R code to peruse if that is what you are looking for.

(more…)

Custom images for Shiny dashboard valueBox icons

The shinydashboard package provides functions like valueBox that conveniently display basic information like summary statistics. In addition to presenting a value and subtitle on a colored background, an icon may be included as well. However, the icon must come from either the Font Awesome or Glyphicon icon libraries and cannot be image files.

I’ve provided a gist that shows how to achieve the use of custom icons with local image files stored in an app’s www/ directory. It involves overriding a couple functions in shiny and shinydashboard and adding a small bit of custom CSS. Ideally, functionality could be included in future versions of these two packages to allow this in a more robust and complete fashion. But for now, here is a way to do it yourself for value boxes.

valueboxes1

(more…)

mapmate 0.2.0

mapmate is under development and blog posts can become outdated quickly. Up to date mapmate documentation and tutorial examples can be found at the official mapmate Github pages.

mapmate has now been updating from version 0.1.0 to 0.2.0 on Github. The key change is the incorporation of new functions, help docs and code examples focused on network maps, which is a more complex map type not previously covered. The new tutorial content below provides a a couple basic code examples for making network maps with mapmate.

While mapmate is aimed at still image sequence generation, allowing the user to exert full control over how still image sequences are used to produce animations subsequently (GUI video editor, ffmpeg, ImageMagick, etc) and not directly at animating from R, the examples here include the use of the animation package to help you quickly reproduce some basic animated gifs (as long as you have ImageMagick installed on your system). But the takeaway message is that mapmate now has better support for still image map sequence generation when using the network map type based on great circle arc path traversal.

If you are new to mapmate there is also the introductory vignette. The content of this post is available on the mapmate Github pages as well.

To install the package:

devtools::install_github("leonawicz/mapmate")

Networks

The save_map function in the mapmate package offers the type="network" map type. This type of map displays networks or pathways defined by overlapping segments traversing along great circle arcs. This map type can be used to display arbitrary line segments as well if such data is provided, but the provided helper functions used here are aimed specifically at drawing great circles.

(more…)

mapmate 0.1.0

mapmate has now been updating from version 0.0.2 to 0.1.0 on Github. The biggest addition is a number of plotting options for making different kinds of maps. The new tutorial content below provides a number of code examples for making a variety of maps and also highlights current limitations associated with certain map types and settings.

Since the code snippets below generate a lot of different plots, the plots are not contained directly in this blog post. See the full tutorial page to see everything. It will also be easier and cleaner to review the examples from there. There is also the accompanying introductory vignette. All can be accessed from the mapmate Github pages.

bkgd

(more…)

mapmate 0.0.2

mapmate is an R package for map- and globe-based data animation pre-production. Specifically, mapmate functions are used to generate and save to disk a series of global map graphics that make up a still image sequence, which can then be used in video editing and rendering software of the user’s choice. This package does not make simple gif animations directly from R, which can be done with packages like animation. mapmate is more specific to maps, hence the name, and particularly suited to high-resolution png image sequences of 3D globe plots of the Earth.

This is a development package. Available on Github. See the updated tutorial or vignette for plenty of example use cases and more detailed discussion of existing features and functionality.

(more…)

Animate maps with mapmate: R package for map- and globe-based still image sequences

[This post is out of date. A newer package version is available on Github and an updated tutorial here]

Introduction to mapmate

mapmate (map animate) is an R package for map animation. It is used to generate and save a sequence of plots to disk as a still image sequence intended for later use in data animation production.

The mapmate package is used for map- and globe-based data animation pre-production. Specifically, mapmate functions are used to generate and save to disk a series of map graphics that make up a still image sequence, which can then be used in video editing and rendering software of the user’s choice. This package does not make simple animations directly within R, which can be done with packages like animation. mapmate is more specific to maps, hence the name, and particularly suited to 3D globe plots of the Earth.

This introduction covers the following toy examples. Generate a sequence of still frames of:

  • map data for use in a flat map animation.
  • dynamic/temporally changing map data projected onto a static globe (3D Earth)
  • static map data projected onto rotating globe
  • dynamic map data projected onto rotating globe

(more…)

R animation: global climate change

I have posted a new R data animation video. It’s an example animation of modeled historical and projected global temperature change from 1850 – 2100. The data prep, analysis, full processing and generation of all sets of still frames for each layer in the video are done using R.

Typically an ensemble of models would be used but this video is just to demonstrate a basic animation using one climate model, both with a monthly time series and a monthly 10-year moving average time series. If wondering about the y-axis range, the animation shows anomalies, or delta change, from the climate model’s historical baseline monthly average temperatures using a given climatology window.

In a later video I will use annual and seasonal averages, which will display a smoother signal than monthly series.