Skip to content

htmlwidgets/datamaps

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 

Datamaps

NOTE: This repo is just for testing purposes

This is an htmlwidgets binding for the datamaps package.

Simple Map

Status: WORKING

library(datamaps)
datamaps()
datamaps(scope = 'usa')

Shiny App

Status: WORKING

library(shiny)
ui = bootstrapPage(
  selectInput('def_fill', 'Select Color', c('blue', 'green')),
  datamapsOutput('mymap', 800, 400)
)

server = function(input, output, session){
  output$mymap <- renderDatamaps(
    datamaps(
      fills = list(defaultFill = input$def_fill)
    )
  )
}

runApp(list(ui = ui, server = server), launch.browser = rstudio::viewer)

Map with External Data

Status: WORKING

This is to test if specifying external data using the attachment mechanism works.

datamaps(
  scope = 'pcs',
  geographyConfig = list(dataUrl = htmlwidgets:::attachment("data/pcs.json"))
)

Shiny App with External Data

Status: WORKING

This is to test if specifying external data in a shiny app using the attachment mechanism works.

library(shiny)
ui = bootstrapPage(
  selectInput('def_fill', 'Select Color', c('blue', 'green')),
  datamapsOutput('mymap', 900, 800)
)

server = function(input, output, session){
  output$mymap <- renderDatamaps(
    datamaps(
      scope = 'pcs', 
      geographyConfig = list(
        dataUrl = htmlwidgets:::attachment('data/pcs.json')
      ),
      fills = list(defaultFill = input$def_fill)
    )
  )
}

runApp(list(ui = ui, server = server), launch.browser = rstudio::viewer)

About

Datamaps Test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published