DataTables
library(DT)
datatable(iris)
Leaflet Maps
library(leaflet)
library(leaflet)
m = leaflet() %>% addTiles()
m # a map with the default OSM tile layer
m = m %>% setView(-93.65, 42.0285, zoom = 17)
# popup
m %>% addPopups(-93.65, 42.0285, 'Here is the <b>Department of Statistics</b>, ISU')
rand_lng = function(n = 10) rnorm(n, -93.65, .01)
rand_lat = function(n = 10) rnorm(n, 42.0285, .01)
# use automatic bounds derived from lng/lat data
m = m %>% clearBounds()
# marker
m %>% addMarkers(rand_lng(), rand_lat())
Dygraphs
library(dygraphs)
dygraph(sunspots) %>% dyRangeSelector()
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths)
Network graphs
library(networkD3)
##
## Attaching package: 'networkD3'
##
## The following object is masked from 'package:leaflet':
##
## JS
##
## The following object is masked from 'package:DT':
##
## JS
data(MisLinks, MisNodes)
str(MisLinks)
## 'data.frame': 254 obs. of 3 variables:
## $ source: int 1 2 3 3 4 5 6 7 8 9 ...
## $ target: int 0 0 0 2 0 0 0 0 0 0 ...
## $ value : int 1 8 10 6 1 1 1 1 2 1 ...
str(MisNodes)
## 'data.frame': 77 obs. of 3 variables:
## $ name : Factor w/ 77 levels "Anzelma","Babet",..: 63 64 51 57 21 33 12 23 20 65 ...
## $ group: int 1 1 1 1 1 1 1 1 1 1 ...
## $ size : int 15 20 23 30 11 9 11 30 8 29 ...
forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
Group = "group", opacity = 0.4)
Three.js
library(threejs)
data(world.cities, package="maps")
cities <- world.cities[order(world.cities$pop,decreasing=TRUE)[1:1000],]
value <- 100 * cities$pop / max(cities$pop)
earth <- texture(system.file("images/world.jpg",package="threejs"))
globejs(img=earth, lat=cities$lat, long=cities$long, value=value)