Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Downloading gabapentinoid prescription data for England from openprescribing.net
#-- Load packages --#
library(readr)
#-- OpenPrescribing API details --#
# API details can be found here: https://openprescribing.net/api/
# Drug codes can be obtained here: https://openprescribing.net/analyse/
#-- Download pregabalin data --#
## Total items prescribed
total_pregabalin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010AE&format=csv')
## Total generic items prescribed
generic_pregabalin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010AEAA&format=csv')
## Total prescribed items for specific brands (Lyrica is the original)
lyrica_pregabalin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010AEBB&format=csv')
rewisca_pregabalin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010AEBC&format=csv')
lecaent_pregabalin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010AEBD&format=csv')
alzain_pregabalin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010AEBE&format=csv')
axalid_pregabalin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010AEBF&format=csv')
#-- Download gabapentin data --#
## Total items prescribed
total_gabapentin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010G0&format=csv')
## Total items prescribed, were neuropathic pain was given as the indication
neup_gabapentin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0407030AD&format=csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.