richardli / surveyPrev

R package to process and map prevalence of common DHS indicators
1 stars 3 forks source link

Trouble getting getDHSindicator to work for Gambia data #4

Open nickhadj1 opened 8 months ago

nickhadj1 commented 8 months ago

Hi there,

My name is Nick Hadjimichael, and I'm a student in Jon Wakefield's class. I have been struggling to get the following code to run (I've included the error)

DHS small area estimation and mapping of womananemia in Gambia

library(devtools) install_github("richardli/surveyPrev") library(surveyPrev)

library(SUMMER) library(rdhs) library(ggplot2) library(patchwork) library(dplyr) library(sf)

GambiaAdm1 <- read_sf(dsn = file.path("gadm41_GMB_shp/gadm41_GMB_1.shp"),stringsAsFactors = F) GambiaAdm1 <- as_Spatial(GambiaAdm1) GambiaAdm2 <- read_sf(dsn = file.path("gadm41_GMB_shp/gadm41_GMB_2.shp"),stringsAsFactors = F) GambiaAdm2 <- as_Spatial(GambiaAdm2)

rdhs::set_rdhs_config(email = "nickhadj@uw.edu", project = "UW BIOST 555 Class Project: DHS small area estimation and mapping of womananemia in Gambia")

indicator <- "womananemia" year <- 2013 country <- "Gambia" dhsData <- getDHSdata(country = country, indicator = indicator, year = year) data <- getDHSindicator(dhsData, indicator = indicator)

""

data <- getDHSindicator(dhsData, indicator = indicator) Error in UseMethod("mutate") : no applicable method for 'mutate' applied to an object of class "list" ""

in speaking with Katie Paulson, TA, in the class, we found that there's some bug here

Just thought I'd let you know!

Thank you kindly

Best, Nick

krpaulson commented 8 months ago

I think it's specifically an issue with the syntax for this indicator, in these parts of the code: https://github.com/richardli/surveyPrev/blob/d94c4c4a1617ecd8a68c1f67aec59e85f62dcfa9/R/indicators.R#L7 https://github.com/richardli/surveyPrev/blob/d94c4c4a1617ecd8a68c1f67aec59e85f62dcfa9/R/getDHSindicator.R#L62