facility_types: get & plot freq of facility types for a country

Description Usage Arguments Value Examples

View source: R/facility_types.r

Description

get & plot freq of facility types for a country

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
facility_types(
  country,
  datasource = "healthsites",
  datasource_title = NULL,
  type_filter = "all",
  type_column = "Facility Type",
  label_column = "Facility Name",
  brewer_palette = "BuPu",
  lonlat_columns = c("Longitude", "Latitude"),
  admin_level = NULL,
  admin_names = NULL,
  plot_title = "default",
  plot = TRUE
)

Arguments

country

a character vector of country names or iso3c character codes.

datasource

data source, 'healthsites' predownloaded, 'who', 'healthsites_live' needs API, 'hdx' not working yet

datasource_title

optional title for datasource to be used in plots - particularly if a filname has been passed for datasource

type_filter

filter by facility type - will depend on the data source

type_column

just for user provided files which column has information on type of site, default : 'Facility Type'

label_column

just for user provided files which column has information on name of site, default : 'Facility Name'

brewer_palette

ColorBrewer palette default 'BuPu',

lonlat_columns

just for user provided files which columns contain longitude, latitude

admin_level

what admin level to filter regions from FALSE or NULL if no filtering

admin_names

names of admin regions to filter NULL if no filter

plot_title

title for plot, 'default', string or NULL for no title

plot

whether to display plot

Value

ggplot2 object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
ggnga <- facility_types("nigeria", datasource='who')

facility_types('chad', datasource='who')
facility_types('chad', datasource='healthsites')


#filter healthsites data by amenity type
facility_types('chad',datasource = 'healthsites', type_filter=c('clinic','hospital'))
#filter who data by Facility type
facility_types('chad',datasource = 'who', type_filter=c('Regional hospital','Health Centre'))

# from an sf object
data(sfssd)
ggssd <- facility_types("south sudan",
                        datasource=sfssd,
                        type_column = "type")

# using consistent 9 class facility types for WHO data, specify type_column='facility_type_9'
facility_types('all', datasource='who', type_column='facility_type_9')

afrimapr/afrihealthsites documentation built on June 12, 2021, 11:46 a.m.