vetools
Source files for the vetools R package
Description
vetools is an integrated data management library for R. It offers a variety of tools concerning the loading and manipulation of environmental data available from different Venezuelan governmental sources. Facilities are provided to plot temporal and spatial data as well as understand the health of a collection of meteorological data.
Where to get
Since version 1.3.28 it is available directly form the CRAN Repo and can be installed in R
install.packages('vetools')
Latest builds can be downloaded directly from this site.
library('devtools')
install_github('talassio/vetools/vetools')
Some demos
library(vetools)
data(Vargas)
Vargas
plot(Vargas)
plot(Vargas$data[[1]], ylab='mm')
title(main=paste('Monthly precipitaion [mm]/month', Vargas$catalog[[1]]$Name)
vetools catalog format can be easily used with other maping packages.
Interactive maps using leaflet package
library(vetools)
library(plyr)
library(leaflet)
data(CuencaCaroni)
LL = CuencaCaroni$catalog %>% ldply(function(x) { c(x$Longitud, x$Latitud, x$Name) } )
colnames(LL) <- c('Longs', 'Lats', 'Names')
BO <- get.shape.state('BO')
range <- get.shape.range(BO)
m = leaflet() %>% addTiles() %>% fitBounds(range[1], range[3], range[2], range[4])
m = m %>% addMarkers(LL$Longs, LL$Lats, popup = LL$Names)
m
Maps using the OpenStreetMap library
library(vetools)
library(plyr)
library(OpenStreetMap)
data(Vargas)
LL = Vargas$catalog %>% ldply(function(x) { c(x$Longitud, x$Latitud, x$Name) } )
colnames(LL) <- c('Longs', 'Lats', 'Names')
VA <- get.shape.state('VA')
range <- get.shape.range(VA)
nm = c("osm", "maptoolkit-topo",
"waze", "mapquest", "mapquest-aerial",
"bing", "stamen-toner", "stamen-terrain",
"stamen-watercolor", "osm-german", "osm-wanderreitkarte",
"mapbox", "esri", "esri-topo",
"nps", "apple-iphoto", "skobbler",
"opencyclemap", "osm-transport",
"osm-public-transport", "osm-bbike", "osm-bbike-german")
i = 1
map = openmap(c(lat = 0.3 + range[4], lon = -0.1 + range[1]),
c(lat = -0.3 + range[3], lon = 0.1 + range[2]), type=nm[i])
mapLL = openproj(map)
plot(mapLL)
title(paste0('vetools+OpenStreetMap(', nm[i],')'))
points(LL$Longs, LL$Lats, pch=16, col='dodgerblue')
points(LL$Longs, LL$Lats, pch=1, col='red2', cex=1.5)
i = 6
map = openmap(c(lat = 0.3 + range[4], lon = -0.1 + range[1]),
c(lat = -0.3 + range[3], lon = 0.1 + range[2]), type=nm[i])
mapLL = openproj(map)
plot(mapLL)
plot(VA, add = T, border = 'red', lwd = 2, lty = 2)
title(paste0('vetools+OpenStreetMap(', nm[i],')'), col.main = 'white')
points(LL$Longs, LL$Lats, pch = 16, col = 'dodgerblue')
points(LL$Longs, LL$Lats, pch = 1, col = 'yellow', cex=1.5)