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
PREFIX qb: <http://purl.org/linked-data/cube#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX sdmx: <http://purl.org/linked-data/sdmx/2009/concept#> | |
PREFIX data: <http://statistics.gov.scot/data/> | |
PREFIX sdmxd: <http://purl.org/linked-data/sdmx/2009/dimension#> | |
PREFIX mp: <http://statistics.gov.scot/def/measure-properties/> | |
PREFIX stat: <http://statistics.data.gov.uk/def/statistical-entity#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
SELECT ?areacode ?areaname ?nratiodrug ?yearname | |
WHERE { |
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(“SPARQL”, lib.loc=”/Library/Frameworks/R.framework/Versions/3.2/Resources/library”) | |
endpoint <- ‘http://statistics.gov.scot/sparql' | |
queryalc <- ‘PREFIX qb: <http://purl.org/linked-data/cube#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX sdmx: <http://purl.org/linked-data/sdmx/2009/concept#> | |
PREFIX data: <http://statistics.gov.scot/data/> | |
PREFIX sdmxd: <http://purl.org/linked-data/sdmx/2009/dimension#> | |
PREFIX mp: <http://statistics.gov.scot/def/measure-properties/> | |
PREFIX stat: <http://statistics.data.gov.uk/def/statistical-entity#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> |
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
dfmerged <- merge(dfalc,dfdrug,by = “areaname”) |
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
ggplot(data = dfdrug, aes(x=reorder(areaname, -nratiodrug), y=nratiodrug, fill=areaname)) + theme_bw() + geom_bar(stat='identity') + theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5)) + ggtitle('Drug-related Hospital Discharges 2012–2013 (Rate per 10,000 people)') + labs(x='Council Area', y='Rate per 100,000 people') + theme(legend.position='none') |
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
cor.test(dfmerged$nratioalcohol,dfmerged$nratiodrug) |
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
ggplot(dfmerged, aes(x=nratiodrug, y=nratioalcohol,label=areaname)) + geom_point(shape=21, size=6, color="blue",fill="red", alpha=0.3) + geom_text(data=subset(dfmerged, nratioalcohol > 1300)) + stat_smooth(method = "lm", col = "red") + ggtitle('Scatterplot Showing Drug and Alcohol-related Hospital Admissions, 2012–2013') + labs(x='Drug-related discharges, per 100,000 people', y='Alcohol-related discharges, per 100,000 people') + theme_bw() |
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
PREFIX dcat: <http://www.w3.org/ns/dcat#> | |
PREFIX dcterms: <http://purl.org/dc/terms/> | |
PREFIX owl: <http://www.w3.org/2002/07/owl#> | |
PREFIX qb: <http://purl.org/linked-data/cube#> | |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX sdmx: <http://purl.org/linked-data/sdmx/2009/concept#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
PREFIX void: <http://rdfs.org/ns/void#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> |
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
##### Very rough!!!! | |
PREFIX qb: <http://purl.org/linked-data/cube#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX sdmx: <http://purl.org/linked-data/sdmx/2009/concept#> | |
PREFIX data: <http://statistics.gov.scot/data/> | |
PREFIX sdmxd: <http://purl.org/linked-data/sdmx/2009/dimension#> | |
PREFIX mp: <http://statistics.gov.scot/def/measure-properties/> | |
PREFIX stat: <http://statistics.data.gov.uk/def/statistical-entity#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> |
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
PREFIX qb: <http://purl.org/linked-data/cube#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX sdmx: <http://purl.org/linked-data/sdmx/2009/concept#> | |
PREFIX data: <http://statistics.gov.scot/data/> | |
PREFIX sdmxd: <http://purl.org/linked-data/sdmx/2009/dimension#> | |
PREFIX mp: <http://statistics.gov.scot/def/measure-properties/> | |
PREFIX stat: <http://statistics.data.gov.uk/def/statistical-entity#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
SELECT ?areaname ?indicatorlabel ?yearname ?value |
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(SPARQL) | |
endpoint<-"http://statistics.gov.scot/sparql" | |
query <- "PREFIX qb: <http://purl.org/linked-data/cube#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX sdmx: <http://purl.org/linked-data/sdmx/2009/concept#> | |
PREFIX data: <http://statistics.gov.scot/data/> | |
PREFIX sdmxd: <http://purl.org/linked-data/sdmx/2009/dimension#> | |
PREFIX mp: <http://statistics.gov.scot/def/measure-properties/> | |
PREFIX stat: <http://statistics.data.gov.uk/def/statistical-entity#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> |
OlderNewer