mst: Multiscalar Typology

Description Usage Arguments Value Examples

View source: R/mst.R

Description

This function compute a multiscalar typology according to the three relative deviations (general: G, territorial: T and spatial: S). The elementary units are classified in eight classes according to their three relative positions.

Usage

1
2
mst(x, var1, var2, ref = NULL, key, spdf, order = NULL, dist = NULL,
  mat = NULL, spdfid = NULL, xid = NULL, threshold, superior = FALSE)

Arguments

x

a dataframe.

var1

name of the numerator variable in x.

var2

name of the denominator variable in x.

ref

ratio of reference; if NULL, the ratio of reference is the one of the whole study area (sum(var1) / sum(var2)).

key

aggregation key field.

spdf

a SpatialPolygonsDataFrame that matches x data frame.

order

contiguity order.

dist

distance threshold defining the contiguity. The cartesian distance between units centroids is used by default (see gDistance); use mat to apply different metrics.

mat

a distance matrix (road distance, travel time...) between x units. Row and column names must fit xid identifiers. (optional)

spdfid

identifier field in spdf, default to the first column of the spdf data frame. (optional)

xid

identifier field in x, default to the first column of x. (optional)

threshold

defined to build the typology (100 is considered as the average).

superior

if TRUE, deviation values must be greater than threshold. If FALSE, deviation values must be lower than threshold.

Value

A dataframe including the initial dataset, the ratio, the 3 relative deviations (G, T and S) and the resulting typology.

Typology (which deviation is over/under the threshold):

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
data("GrandParisMetropole")
synthesis <- mst(spdf = com.spdf,
                        x = com,
                        spdfid = "DEPCOM",
                        xid = "DEPCOM",
                        var1 = "INC",
                        var2 = "TH",
                        dist = NULL,
                        key = "EPT",
                        order = 1,
                        mat = NULL,
                        threshold = 125,
                        superior = TRUE)

if(require('cartography')){
  library(sp)
  par(mar = c(0,0,1.2,0))
  typoLayer(spdf = com.spdf, df = synthesis, var = "mst",
            border = "#D9D9D9",legend.values.order = 0:7, 
            col = c("#f0f0f0", "#fdc785","#ffffab","#fba9b0",
                    "#addea6","#ffa100","#fff226","#e30020"),
            lwd = 0.25,
            legend.pos = "n")
  
  plot(ept.spdf,add=TRUE)
  
  colours <- c("#f0f0f0", "#fdc785","#ffffab","#fba9b0",
               "#addea6","#ffa100","#fff226","#e30020")
  
  rVal<-c(" .     .   . ",
          "[X]   .   . ",
          " .   [X]  . ",
          "[X] [X]  . ",
          " .    .   [X]",
          "[X]  .   [X]",
          " .   [X] [X]",
          "[X] [X] [X]")
  
  legendTypo(col = colours, categ = rVal,
             title.txt = "General, territorial and spatial\ndeviations above 125 %
             \n       G T S",
             nodata = FALSE)
  
  layoutLayer(title = "Multiscalar Typology",
              sources = "GEOFLA® 2015 v2.1, Apur, impots.gouv.fr",
              author = "MTA")
}

MTA documentation built on May 14, 2018, 5:03 p.m.