Learn R Programming

MTA (version 0.1.2)

mst: Multiscalar Typology

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

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.

  • 0: none

  • 1: G

  • 2: T

  • 3: G and T

  • 4: S

  • 5: G and S

  • 6: T and S

  • 7: G, T and S

Examples

Run this code
# NOT RUN {
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<U+00AE> 2015 v2.1, Apur, impots.gouv.fr",
              author = "MTA")
}
# }

Run the code above in your browser using DataLab