Réaliser une carte avec R (1)

Ce tutoriel en plusieurs parties a pour but d’expliquer comment réaliser une carte avec le logiciel de statistiques R. Je me limiterai à la réalisation des cartes descriptives et analytiques simples telles que peut en avoir besoin un linguiste de terrain ou un dialectologue, et je donnerai des liens pour des travaux de cartographie plus avancés. Les exemples présentés concerneront des cartes du Japon, notamment de la région des Ryūkyū, mais ils sont bien sûr adaptables à toutes les régions du monde.

Vous pouvez télécharger le code source complet du notebook R de ce tutoriel ici et le fichier contenant uniquement le code R ici.

Avant toute chose

De nombreux collègues linguistes apprécient les cartes que j’utilise dans mes publications, et certains me demandent de temps à autre d’en réaliser pour eux. J’ai ainsi par exemple réalisé l’ensemble des cartes des ouvrages An introduction to Ryukyuan languages et Handbook of Ryukyuan Languages, ou encore la carte d’un récent article de Lai Yunfan dans les Cahiers de Linguistique Asie Orientale. Or comme dit le proverbe, qui n’est ni une citation de Lao Zi ou de Confucius ni même un dicton chinois, «donne un poisson à un homme, il mangera un jour; apprends-lui à pêcher, il mangera toute sa vie», et il est prséférable que j’explique comment je réalise mes cartes.

Pourquoi réaliser des cartes avec R? Parce que tout d’abord une simple capture d’écran de Google Maps fait rarement une belle carte. Ensuite parce que parmi tous les logiciels permettant de faire des cartes, R est celui qui est le plus susceptible d’être déjà connu et d’être utile de manière générale à un linguiste. En effet, R n’est pas un logiciel de cartographie mais de statistiques, et la maitrise de R poura donc servir dans d’autres contextes, tandis qu’un logiciel de cartographie demanderait un investissement particulier pour apprendre à s’en servir. Enfin, R est gratuit, libre, et il s’agit d’un langage de programmation qui permet donc de travailler efficacement en utilisant des scripts plutôt qu’une interface «pointer et cliquer». On pourra comparer avec la procédure présentée sur le blog de Language Science Press, où il faut télécharger et modifier manuellement une carte. Cette procédure est tout à fait valable, mais cela devient vite peu pratique et particulièrement chronophage si l’on a besoin de réaliser de nombreuses cartes ou de les modifier souvent. Toute action répétitive sur un ordinateur devrait être automatisée par un script (c’est la raison d’être d’un ordinateur!). Il n’est pas non plus possible de cartographier des données quantitatives comme on le verra au cours de ce tutoriel.

Je considére pour ce tutoriel que le lecteur maitrise les bases du logiciel R, et notamment la création de graphiques avec le module ggplot2. Je ne détaillerai toutes les fonctions et options disponibles, pour lesquelles la documentation de R doit être consultée.

Première carte

Commençons par réaliser une carte simple avec le module ggmap. Nous allons tout d’abord obtenir un fond de carte centrée autour de Shuri, à Okinawa, depuis les serveurs Google Maps. Il suffit de récupérer les coordonnées de Shuri, par exemple sur Google Maps en faisant clic droit sur la carte et en sélectionnant «Plus d’infos sur cet endroit». La fonction geocode() permet aussi de trouver les coordonnées de lieux identifiés.

 

require(ggmap)
shuri <- geocode("Shuri castle") # équivalent à shuri <- c(lon = 127.195, lat = 26.21701)
shuriMap <- get_map(location = shuri)
ggmap(shuriMap)

Zoom

On peut régler le zoom avec l’option du même nom de la fonction get_map().

shuriMap <- get_map(location = shuri, zoom = 8)
ggmap(shuriMap)

shuriMap <- get_map(location = shuri, zoom = 16)
ggmap(shuriMap)

Couleur

L’option color permet de choisir entre une carte en couleurs et une carte en noir et blanc (en fait en niveaux de gris).

shuriMap <- get_map(location = shuri, color = "bw")
ggmap(shuriMap)

Type

L’option maptype permet de choisir entre les types de visualisation proposés.

shuriMap <- get_map(location = shuri, maptype = "satellite")
ggmap(shuriMap)

Source

Enfin, il est possible d’utiliser d’autres sources de cartes avec l’option source. Malheureusement, pour des raisons technniques, il n’est plus possible d’utiliser source = "osm" pour afficher des cartes OpenStreetMap. L’autre source, Stamen, est toujours utilisable avec source = "stamen", mais j’ai du installer la dernière version de ggmap depuis github avec la fonction devtools::install_github("dkahle/ggmap").

shuriMap <- get_map(location = shuri, source = "stamen")
ggmap(shuriMap)

Les cartes Stamen sont sans doute les plus pratiques puisqu’on peut obtenir séparément le fond de carte, les lignes, et les étiquettes toponymiques.

shuriMap <- get_map(location = shuri, source = "stamen", maptype = "terrain-background")
ggmap(shuriMap)

shuriMap <- get_map(location = shuri, source = "stamen", maptype = "terrain-lines")
ggmap(shuriMap)

shuriMap <- get_map(location = shuri, source = "stamen", maptype = "terrain-labels")
ggmap(shuriMap)

Deuxième carte plus avancée: Annotations et décorations

On peut également utiliser la fonction get_stamenmap() et utiliser une paire coordonées passées à l’option bbox pour donner les limites d’une carte Stamen.

shuriMap <- get_stamenmap(bbox = c(left = 126.65, bottom = 26, right = 128.4, top = 26.9), maptype = "terrain-background", zoom = 10)
ggmap(shuriMap)

Une fois la carte de base réalisée on peut bien sûr utiliser les fonctions standard de ggplot2 pour annoter ou décorer notre carte.

ggmap(shuriMap) + 
  geom_point(data = shuri, aes(x = lon, y = lat), color = "red") +
  geom_text(data = shuri, aes(x = lon, y = lat), label = "Shuri", hjust = -0.2, vjust = 0)

L’avantage ici de R et de ggplot2 est qu’on peut facilement afficher un grand nombre de points. Attention néanmoins à la limite de requêtes addressables par geocode.

locs <- c("Shuri castle","Nakijin Yonamine", "Maja Kume-jima","Iejima", "Kudaka")
locsCoord <- geocode(locs, output = "more")
locsCoord$label <- c("Shuri","Yonamine", "Maja","Iejima", "Kudaka")
ggmap(shuriMap) + 
  geom_point(data = locsCoord, aes(x = lon, y = lat), color = "red") +
  geom_text(data = locsCoord, aes(x = lon, y = lat, label = label), hjust = -0.2, vjust = 0)

Enfin, il suffit de sauvegarder la carte sous le nom et au format voulus avec ggsave().

mymap <- ggmap(shuriMap) + 
  geom_point(data = locsCoord, aes(x = lon, y = lat), color = "red") +
  geom_text(data = locsCoord, aes(x = lon, y = lat, label = label), hjust = -0.2, vjust = 0)
ggsave(filename = "mymap.pdf", plot = mymap)

Remarques finales

Vous pouvez télécharger le code source complet du notebook R de ce tutoriel ici et le fichier contenant uniquement le code R ici.

Ceci est suffisant pour réaliser une carte descriptive simple, mais il y a deux limitations. Tout d’abord, il faut être connecté à internet pour que R puisse récupérer la carte, et un trop grand nombre de demandes peut saturer le serveur. En outre, il n’est pas possible de réaliser une carte un peu plus complexe, qui par exemple n’affiche pas uniquement des points correspondant à des localités mais met en valeur une division administrative (commune, préfecture, région, pays, etc.).

À suivre dans la deuxième partie.

Ce billet peut être cité de la façon suivante: Thomas Pellard, « Réaliser une carte avec R (1) », Cipanglossia, 19 juin 2017, https://cipanglo.hypotheses.org/375.


Vous aimerez aussi...

14 réponses

  1. Frédéric Stévenot dit :

    Ouh là : tout a été copié. Toutes mes excuses.
    Je voulais que j’obtiens des erreurs :

    > shuri shuriMap <- get_map(location = shuri, source = "stamen", maptype = "terrain-lines")
    Erreur : Google now requires an API key.
    See ?register_google for details.

    Merci de votre aide

    • Oui, pour utiliser l’API de Google Maps il faut s’inscrire et donner un numéro de carte bancaire pour facturation en cas de dépassement du quota de données. Il vaut mieux se tourner vers d’autres solutions.

  2. Frédéric Stévenot dit :

    Bonjour,
    Erreur après :
    > shuri shuriMap require(ggmap)
    Le chargement a nécessité le package : ggmap
    Warning message:
    In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
    aucun package nommé ‘ggmap’ n’est trouvé
    > install.packages(“ggmap”)
    Installing package into ‘/home/fred/R/x86_64-pc-linux-gnu-library/4.0’
    (as ‘lib’ is unspecified)
    also installing the dependencies ‘curl’, ‘openssl’, ‘httr’

    essai de l’URL ‘https://cloud.r-project.org/src/contrib/curl_4.3.tar.gz’
    Content type ‘application/x-gzip’ length 673779 bytes (657 KB)
    ==================================================
    downloaded 657 KB

    essai de l’URL ‘https://cloud.r-project.org/src/contrib/openssl_1.4.3.tar.gz’
    Content type ‘application/x-gzip’ length 1207708 bytes (1.2 MB)
    ==================================================
    downloaded 1.2 MB

    essai de l’URL ‘https://cloud.r-project.org/src/contrib/httr_1.4.2.tar.gz’
    Content type ‘application/x-gzip’ length 159950 bytes (156 KB)
    ==================================================
    downloaded 156 KB

    essai de l’URL ‘https://cloud.r-project.org/src/contrib/ggmap_3.0.0.tar.gz’
    Content type ‘application/x-gzip’ length 4988394 bytes (4.8 MB)
    ==================================================
    downloaded 4.8 MB

    * installing *source* package ‘curl’ …
    ** package ‘curl’ correctement décompressé et sommes MD5 vérifiées
    ** using staged installation
    Found pkg-config cflags and libs!
    Using PKG_CFLAGS=-I/usr/include/x86_64-linux-gnu
    Using PKG_LIBS=-lcurl
    ** libs
    rm -f curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o interrupt.o multi.o nslookup.o reflist.o split.o ssl.o typechecking.o utils.o version.o winidn.o writer.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c callbacks.c -o callbacks.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c curl.c -o curl.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c download.c -o download.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c escape.c -o escape.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c fetch.c -o fetch.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c form.c -o form.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c getdate.c -o getdate.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c handle.c -o handle.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ieproxy.c -o ieproxy.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c interrupt.c -o interrupt.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c multi.c -o multi.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c nslookup.c -o nslookup.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c reflist.c -o reflist.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c split.c -o split.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ssl.c -o ssl.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c typechecking.c -o typechecking.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c utils.c -o utils.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c version.c -o version.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c winidn.c -o winidn.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c writer.c -o writer.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o interrupt.o multi.o nslookup.o reflist.o split.o ssl.o typechecking.o utils.o version.o winidn.o writer.o -lcurl -L/usr/lib/R/lib -lR
    installing to /home/fred/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-curl/00new/curl/libs
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    ** checking absolute paths in shared objects and dynamic libraries
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
    * DONE (curl)
    * installing *source* package ‘openssl’ …
    ** package ‘openssl’ correctement décompressé et sommes MD5 vérifiées
    ** using staged installation
    Found pkg-config cflags and libs!
    Using PKG_CFLAGS=
    Using PKG_LIBS=-l:libssl.so.1.1 -l:libcrypto.so.1.1
    ** libs
    rm -f aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pbkdf.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o x25519.o openssl.so bcrypt/libstatbcrypt.a bcrypt/bcrypt_pbkdf.o bcrypt/blowfish.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c aes.c -o aes.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c base64.c -o base64.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c bignum.c -o bignum.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c cert.c -o cert.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c compatibility.c -o compatibility.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c diffie.c -o diffie.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c envelope.c -o envelope.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c error.c -o error.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c hash.c -o hash.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c info.c -o info.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c keygen.c -o keygen.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c keys.c -o keys.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c onload.c -o onload.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c openssh.c -o openssh.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c password.c -o password.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c pbkdf.c -o pbkdf.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c pem.c -o pem.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c pkcs12.c -o pkcs12.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c pkcs7.c -o pkcs7.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rand.c -o rand.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rsa.c -o rsa.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c signing.c -o signing.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ssl.c -o ssl.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c stream.c -o stream.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c write.c -o write.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c x25519.c -o x25519.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c bcrypt/bcrypt_pbkdf.c -o bcrypt/bcrypt_pbkdf.o
    gcc -std=gnu99 -I”/usr/share/R/include” -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oKyfjH/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c bcrypt/blowfish.c -o bcrypt/blowfish.o
    ar rcs bcrypt/libstatbcrypt.a bcrypt/bcrypt_pbkdf.o bcrypt/blowfish.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o openssl.so aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pbkdf.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o x25519.o -Lbcrypt -lstatbcrypt -l:libssl.so.1.1 -l:libcrypto.so.1.1 -L/usr/lib/R/lib -lR
    installing to /home/fred/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-openssl/00new/openssl/libs
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    ** checking absolute paths in shared objects and dynamic libraries
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
    * DONE (openssl)
    * installing *source* package ‘httr’ …
    ** package ‘httr’ correctement décompressé et sommes MD5 vérifiées
    ** using staged installation
    ** R
    ** demo
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
    * DONE (httr)
    * installing *source* package ‘ggmap’ …
    ** package ‘ggmap’ correctement décompressé et sommes MD5 vérifiées
    ** using staged installation
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
    * DONE (ggmap)

    The downloaded source packages are in
    ‘/tmp/Rtmp0c6kzk/downloaded_packages’
    > shuri shuriMap shuri shuri shuriMap require(ggmap)
    Le chargement a nécessité le package : ggmap
    Le chargement a nécessité le package : ggplot2
    Google’s Terms of Service: https://cloud.google.com/maps-platform/terms/.
    Please cite ggmap if you use it! See citation(“ggmap”) for details.
    > shuri ?register_google
    > showing_key()
    [1] FALSE
    > ggmap_show_api_key()
    ggmap will now display PRIVATE api keys in the console.
    > shuri showing_key()
    [1] TRUE
    > ggmap_show_api_key()
    ggmap will now display PRIVATE api keys in the console.
    > ggmap_hide_api_key()
    ggmap will now suppress private api keys in the console.
    > scrub_key(string,with = “xxx”)
    Error in stri_replace_all_regex(string, pattern, fix_replacement(replacement), :
    objet ‘string’ introuvable
    > api register_google(key = api)
    > getOption(“ggmap”)
    $google
    Key –
    Account Type – standard
    Day Limit – Inf
    Second Limit – 50
    Client –
    Signature –

    $display_api_key
    [1] FALSE

    attr(,”class”)
    [1] “ggmap_credentials”
    > locations locations %
    +
    +
    + getOption(“ggmap”)
    Error in getOption(., “ggmap”) : ‘x’ must be a character string
    > getOption(“ggmap”)
    $google
    Key –
    Account Type – standard
    Day Limit – Inf
    Second Limit – 50
    Client –
    Signature –

    $display_api_key
    [1] FALSE

    attr(,”class”)
    [1] “ggmap_credentials”
    > locations %
    + geocode()
    Erreur : Google now requires an API key.
    See ?register_google for details.
    > shuriMap ggmap(shuriMap)
    Error in ggmap(shuriMap) : objet ‘shuriMap’ introuvable
    > shuriMap shuriMap <- get_map(location = shuri, source = "stamen", maptype = "terrain-lines")
    Erreur : Google now requires an API key.
    See ?register_google for details.

    Merci de votre aide

  3. Frédéric Stévenot dit :

    Au fait, la dernière partie du tutoriel laisse augurer d’une suite : est-elle encore au programme ?
    Et une autre question : comment vous êtes-vous formé à R ?

  4. Frédéric Stévenot dit :

    Bonsoir,
    Je découvre votre travail sur R seulement maintenant, par le biais de TeXnique que je fréquente pourtant très assidûment : je n’avais pas parcouru la colonne de droite avec suffisamment d’attention.
    J’ai fait quelques essais avec R, il y a quelques années, assez peu concluants. Votre démarche me paraît très méthodique et précise : elle peut convenir à des débutants (ou quasiment). Je voulais donc vous en remercier : mes cours vont pouvoir prendre une autre tournure.

  5. leila dit :

    Oranmap <- get_map(location = Oran, source = "stamen")
    bonjour
    à chaque fois que j'essaye de travailler avec stamen j'ai ce message d'erreur !!

    Error in readJPEG(tmp) :
    JPEG decompression error: Not a JPEG file: starts with 0x89 0x50

    que faut il faire ??

  1. 21 juin 2017

    […] la première et la deuxième partie du tutoriel nous avons vu comment réaliser des cartes de qualité et […]

  2. 26 juin 2017

    […] première partie du tutoriel nous a permis de réaliser une carte descriptive simple à partir d’images de fonds de cartes […]

  3. 26 juin 2017

    […] les parties 1, 2 et 3, nous avons vu comment réaliser des cartes descriptive simples et nous avons abordé la […]

  4. 2 juillet 2017

    […] aux parties 1, 2, 3, 4, 5, et 6, nous allons à présent voir quelques réglages et décorations pour finaliser […]

  5. 2 juillet 2017

    […] aux parties 1, 2, 3, 4, et 5, nous allons à présent voir quelques transformations et opérations sur les […]

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée.

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.

Rechercher dans OpenEdition Search

Vous allez être redirigé vers OpenEdition Search