#Aranjuez, Madrid
BD<-readSIAR(28,3,'01/01/2008','31/12/2008')
xyplot(TempMedia~G0|equal.count(VelViento),data=BD)
## Plot the stations in a map
library(sp)
library(maptools)
SIAR <- read.csv('http://solar.r-forge.r-project.org/data/SIAR.csv')
proj <- CRS('+proj=longlat +ellps=WGS84')
spSIAR <- SpatialPointsDataFrame(SIAR[, c(6, 7)], SIAR[, -c(6, 7)],
proj4str=proj)
###download a shapefile with the administrative borders of Spain
old <- setwd(tempdir())
download.file('http://www.gadm.org/data/shp/ESP_adm.zip', 'ESP_adm.zip')
unzip('ESP_adm.zip')
mapaSHP <- readShapeLines('ESP_adm2.shp', proj4string=proj)
setwd(old)
p <- spplot(spSIAR['Comunidad'],
col.regions=brewer.pal(n=12, 'Paired'),
key.space='right', scales=list(draw=TRUE),
type=c('p','g'))
p + layer(sp.lines(mapaSHP))
Run the code above in your browser using DataLab