ropensci / fingertipsR

R package to interact with Public Health England’s Fingertips data tool
https://docs.ropensci.org/fingertipsR
92 stars 18 forks source link

Using IndicatorID but unable to get any data #70

Closed Silico-Sapiens closed 5 years ago

Silico-Sapiens commented 5 years ago

I am looking at DomainID | DomainName | ProfileID | ProfileName 1938133110 | Stroke | 135 | Cardiovascular Disease

I can retrieve data by: Stroke_df <- fingertips_data(IndicatorID = 212) write.csv(Stroke_df, file = "StrokePrevalence.csv")

But I can't retrieve data by: AFPrevalence_df <- fingertips_data(IndicatorID = 280) write.csv(AFPrevalence_df, file = "AFPrevalence.csv") or AFPrevalence_est_df <- fingertips_data(IndicatorID = 91459) write.csv(AFPrevalence_est_df, file = "AFPrevalence_est.csv") or df_df <- fingertips_data(IndicatorID = 91013) write.csv(df_df, file = "df.csv") or There could be more...

sebastian-fox commented 5 years ago

Hi @Johnny-Cho , thanks for the message. The indicators you are looking at have no data for the default AreaTypeID, which is 102 (County & UA). See this explanation of how you find out the area types that each indicator have data for:

library(fingertipsR)
library(dplyr)

inds <- c(280, 91459, 91013)
df <- fingertips_data(inds) #NO DATA

ind_at <- indicator_areatypes() %>%
  filter(IndicatorID %in% inds)

# this shows which area types your indicators have data for
table(ind_at$IndicatorID, ind_at$AreaTypeID)

# this tell you what each area type is and what areas they map to.
# you can use the ParentAreaTypeID values in the fingertips_data() function too
View(area_types(), "Area types")

df_new <- fingertips_data(inds, AreaTypeID = 154)