This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(RCurl) | |
| library(rjson) | |
| whatGoogleSuggestsFor <- function(question, domain="fr") { | |
| # Domain : here, just France or USA | |
| # You could add URLs for some other countries | |
| if (domain == "fr") { | |
| baseU <- "https://www.google.fr/s?gs_rn=45&sclient=psy-ab" | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(XML) | |
| library(RCurl) | |
| library(rgdal) | |
| source("DORLING.R") | |
| # GEOGLA DEPARTEMENTS | |
| deps <- readOGR(".", "DEPARTEMENT.shp") | |
| # LIST URLS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(rgeos) | |
| library(spdep) | |
| # DISTANCE | |
| distance <- function(pt1, pt2) { | |
| dx <- pt1[1] - pt2[1] | |
| dy <- pt1[2] - pt2[2] | |
| l <- sqrt(dx^2 + dy^2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(rgeos) | |
| library(maptools) | |
| load("F:/DATAS/DEPARTEMENT.rda") | |
| foret <- read.csv2("IN/foret.csv") | |
| ###################### | |
| ## SCALED CARTOGRAM ## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Map { | |
| background-color: rgb(50,50,50); | |
| } | |
| #deps { | |
| line-color:white; | |
| line-width:1; | |
| line-opacity:.8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(rgdal) | |
| countries <- readOGR("D:/DATAS/NATURAL EARTH/ne_110m_admin_0_countries_lakes/ne_110m_admin_0_countries_lakes.shp", "ne_110m_admin_0_countries_lakes") | |
| first <- substr(as.character(countries$name),0,1) # on détermine la première lettre du nom du pays | |
| first[grep("Sahara", countries$name)] <- "S" | |
| first[grep("Guinea", countries$name)] <- "G" | |
| first[grep("Korea", countries$name)] <- "K" | |
| first[grep("Congo", countries$name)] <- "C" | |
| first[grep("Antarctic", countries$name)] <- "A" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(rgdal) | |
| library(spatstat) | |
| library(maptools) | |
| library(rgeos) | |
| setwd("D:/METHODES/1211_ELONGATEDCOUNTRIES/") | |
| countries <- readOGR("D:/DATAS/NATURAL EARTH/ne_110m_admin_0_countries_lakes/ne_110m_admin_0_countries_lakes.shp", "ne_110m_admin_0_countries_lakes") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(rgdal) | |
| library(wordcloud) | |
| library(reshape) | |
| library(maptools) | |
| library(classInt) | |
| library(FactoMineR) | |
| library(FNN) | |
| ### LOAD DATA ### | |
| f <- readOGR(".", "COMMUNE") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(rgdal) | |
| library(spdep) | |
| pol <- readOGR(".", "buildings") # read the data using rgdal | |
| nb <- poly2nb(pol, snap=50) # create a graph. Two buildings are connected if they are 50 meters apart from one another. | |
| pol$nNeigh <- card(nb) # card(nb) gives the neighbor counts | |
| pol$neighGroup <- n.comp.nb(nb)$comp.id # n.comp.nb contains the informations about the disconnected compontents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##[datagistips]=group | |
| ##polygons=vector | |
| ##distance=number 10 | |
| ##output=output vector | |
| library("spdep") | |
| nb = poly2nb(polygons, snap=distance) | |
| polygons[["nNeigh"]] = card(nb) |