Vous êtes sur la page 1sur 14

Pauvreté monétaire au Sénegal: Analye

spatiale
NGOULOU NGOUBILI Irch Defluviaire

Importation des packages

Nous importons le fichier shapefile du S�negal qui contient 14 subdivistions qui repr�sentent
dans ce cas les r�gions administratives du pays.

library(sf)

Linking to GEOS 3.11.2, GDAL 3.7.2, PROJ 9.3.0; sf_use_s2() is TRUE

library(mapsf)
library(ggplot2)
library(sp)
library(tmap)

Breaking News: tmap 3.x is retiring. Please test v4, e.g. with
remotes::install_github('r-tmap/tmap')

library(spdep)

Le chargement a nécessité le package : spData

To access larger datasets in this package, install the spDataLarge


package with: `install.packages('spDataLarge',
repos='https://nowosad.github.io/drat/', type='source')`

1
library(spData)
library(GeoXp)
library(RColorBrewer)
library(ggspatial)
library(rnaturalearth)

Support for Spatial objects (`sp`) will be deprecated in {rnaturalearth} and will be removed

library(rnaturalearthdata)

Attachement du package : 'rnaturalearthdata'

L'objet suivant est masqué depuis 'package:rnaturalearth':

countries110

library(dplyr)

Attachement du package : 'dplyr'

Les objets suivants sont masqués depuis 'package:stats':

filter, lag

Les objets suivants sont masqués depuis 'package:base':

intersect, setdiff, setequal, union

Les r�gions administratives du S�negal:

library(mapsf)
senegal = st_read(dsn = "Shapefile/gadm41_SEN_1.shp", stringsAsFactors = F)

2
Reading layer `gadm41_SEN_1' from data source
`E:\ISEL 3\SES\Projet final\Shapefile\gadm41_SEN_1.shp' using driver `ESRI Shapefile'
Simple feature collection with 14 features and 11 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -17.54319 ymin: 12.30786 xmax: -11.34247 ymax: 16.69207
Geodetic CRS: WGS 84

par(mar = c(0.1, 0.1, 0.2, 5))


plot(senegal$geometry)
mf_label(
x = senegal, var = "NAME_1", col = "grey10", halo = TRUE, overlap = TRUE, lines = FALSE)

Saint−Louis
Saint−Louis
Saint−Louis

Louga
Louga
Louga
Matam
Matam
Matam
Thiès Diourbel
Dakar Thiès
Thiès Diourbel
Dakar
Dakar

Fatick
Fatick Kaffrine
Kaffrine
Fatick
Kaolack
Kaolack
Kaolack Tambacounda
Tambacounda
Tambacounda

Kolda
Kolda
Kolda
Sédhiou
Sédhiou
Sédhiou Kédougou
Kédougou
Kédougou
Ziguinchor
Ziguinchor
Ziguinchor

ggplot(senegal) + geom_sf(aes(fill = NAME_1)) + scale_fill_discrete(name = "R�gions")+


theme(axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text = element_blank())+
annotation_scale(location = "br", line_width = .5)+
annotation_north_arrow(location = "left", height = unit(0.7, "cm"), width = unit(0.7, "c

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :

3
erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

4
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

5
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

6
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

7
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

8
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

9
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

10
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <ef>

Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bf>

Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :


erreur de conversion de 'R�gions' dans 'mbcsToSbcs' : le point est substitué
pour <bd>

R...gions
Dakar
Diourbel
N
Fatick
Kaffrine
Kaolack
Kédougou
Kolda
Louga
Matam
Saint−Louis
Sédhiou
Tambacounda
100 km
Thiès
Ziguinchor

11
library(readxl)
sn_dta = read_excel("Sen_Data.xlsx")
names(sn_dta)

[1] "Region" "Dps_moy_cons" "P0" "P1"


[5] "P2" "Gini" "alphab_H" "alphab_F"
[9] "TX_emp_mn_oeuvre" "TX_CHM" "Popu" "Superficie"
[13] "Densite" "TNS_primaire" "I_parite_P" "TNS_second"
[17] "I_parite_S" "I_synth_fecond" "Tx_fecond_desir" "Tx_fcond"
[21] "Poss_moustq" "Prev_VIH" "Prop_F_excise"

Connexion entre la base spatiale et le fichier shapefile

sn_df = inner_join(senegal[,c("NAME_1","geometry")],sn_dta, by= c("NAME_1"="Region"))

class(sn_df)

[1] "sf" "data.frame"

Analyse descriptive des variables :

sn_sf = st_as_sf(sn_df, coords = c("longitude", "latitude"))


histomap(sn_df, "Dps_moy_cons", nbcol = 4, type = "count", identify = "NAME_1",cex.lab = 0

Warning in st_point_on_surface.sfc(st_geometry(sf.obj)): st_point_on_surface


may not give correct results for longitude/latitude data

par(mar= c(0,0,0,1))
plot(sn_df$geometry)
text(st_coordinates(st_centroid(sn_df$geometry, of_largest_polygon=TRUE)), label=sn_df$NAM

12
Saint−Louis

Louga
Matam

Thiès Diourbel
Dakar

Fatick Kaffrine
Kaolack
Tambacounda

Kolda
Sédhiou Kédougou
Ziguinchor

ggplot() + geom_sf(data=sn_df, aes(fill = Superficie)) +


scale_fill_gradient(name = "Superficie en Km2",
low = "white",high = "blue")+
theme_void()+
ggtitle("Superficie")+
geom_sf_text(data=sn_df,aes(label=NAME_1),size=4,color="Black")+
theme(plot.title = element_text(hjust = 0.001), plot.background = element_rect(fill = "g

Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not


give correct results for longitude/latitude data

13
Superficie

Saint−Louis

Louga Superficie en Km2


Matam 40000

Thiès Diourbel
Dakar 30000

Fatick Kaffrine 20000


Kaolack
Tambacounda 10000

Kolda
Sédhiou Kédougou
Ziguinchor

14

Vous aimerez peut-être aussi