Allison’s Ramphs code

dataset for this code is here: https://gist.github.com/sfsheath/5c5987269e8aad412416

require(curl)
## Loading required package: curl
require(DT)
## Loading required package: DT
require(jsonlite)
## Loading required package: jsonlite
## 
## Attaching package: 'jsonlite'
## 
## The following object is masked from 'package:utils':
## 
##     View
require(rgdal)
## Loading required package: rgdal
## Loading required package: sp
## rgdal: version: 0.9-1, (SVN revision 518)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 1.9.2, released 2012/10/08
## Path to GDAL shared files: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rgdal/gdal
## Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
## Path to PROJ.4 shared files: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rgdal/proj
require(plyr)
## Loading required package: plyr
ramphs <-read.csv(curl("https://gist.githubusercontent.com/sfsheath/5c5987269e8aad412416/raw/a12dda2b8a681f1ab01421f68ac237ab591ff0f9/roman-amphitheaters.csv"))
periods <- fromJSON("https://gist.githubusercontent.com/sfsheath/cc082cc6db3ac8343e3a/raw/6e938ed37b9083f393a67bec10b46ba7fc693661/amphitheater-chronogrps.json")
## Warning: Unexpected Content-Type: text/plain
roman.outline <- readOGR("https://gist.githubusercontent.com/sfsheath/7726c6f5fff9aa45ee15/raw/c828e6a3182bc1058b6cee1788a8e58e2dbc5aad/rome200.geojson", layer="OGRGeoJSON", disambiguateFIDs = T)
## OGR data source with driver: GeoJSON 
## Source: "https://gist.githubusercontent.com/sfsheath/7726c6f5fff9aa45ee15/raw/c828e6a3182bc1058b6cee1788a8e58e2dbc5aad/rome200.geojson", layer: "OGRGeoJSON"
## with 112 features and 8 fields
## Feature type: wkbMultiPolygon with 2 dimensions
ramphs.sp <- ramphs
join(ramphs.sp, periods, by= "chronogrp") -> ramphs.joined
coordinates(ramphs.joined) <- ~longitude + latitude


ramphs.noise <- ramphs.joined

tmp.length <- length(ramphs.noise$start_date[ramphs.noise$chronogrp=="Imperial"])
tmp.min  <- min(ramphs.noise$start_date[ramphs.noise$chronogrp=="Imperial"])
tmp.max  <- max(ramphs.noise$end_date[ramphs.noise$chronogrp=="Imperial"])


ramphs.noise$start_date[ramphs.noise$chronogrp=="Imperial"] <- runif(tmp.length,
                                                                     min=tmp.min,
                                                                     max=tmp.max)
round(ramphs.noise$start_date, digits=0) -> ramphs.noise$start_date

ramphs.noise[c("label", "start_date", "end_date")] -> ramphs.noise.date

# look for file noisedatetest on hard drive, and .json
plot(ramphs.noise.date)
plot(roman.outline, add = T)

datatable(ramphs[1:4])