Created
September 26, 2018 14:47
-
-
Save portableant/5d170db8514687663f1a28718ec9f1c2 to your computer and use it in GitHub Desktop.
Get coin data for Steph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(jsonlite) | |
url <- 'https://finds.org.uk/database/search/results/q/objectType:COIN+-institution%3AIARCW+-institution:CCI/createdBefore/2017-11-12/format/json' | |
json <- fromJSON(url) | |
total <- json$meta$totalResults | |
results <- json$meta$resultsPerPage | |
pagination <- ceiling(total/results) | |
keeps <- c("id","old_findID","broadperiod", "objectType", "institution", "creator", "fourFigureLat", "fourFigureLon") | |
data <- json$results | |
data <- data[,(names(data) %in% keeps)] | |
for (i in seq(from=2, to=pagination, by=1)){ | |
urlDownload <- paste(url, '/page/', i, sep='') | |
pagedJson <- fromJSON(urlDownload) | |
records <- pagedJson$results | |
records <- records[,(names(records) %in% keeps)] | |
data <-rbind(data,records) | |
} | |
write.csv(data, file='inscribedSealMatrices.csv',row.names=FALSE, na="") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment