prepare_mat: Flow matrix preparation

View source: R/prepare_mat.R

prepare_matR Documentation

Flow matrix preparation

Description

From a long format matrix to a a wide format matrix.

Usage

prepare_mat(x, i, j, fij)

Arguments

x

A data.frame of flows between origins and destinations: long format matrix (origins, destinations, flows intensity).

i

A character giving the origin field name in mat.

j

A character giving the destination field name in mat.

fij

A character giving the flow field name in mat.

Value

A square matrix of flows. Diagonal can be filled or empty depending on data used.

Examples

# Import data
nav <- read.csv(system.file("csv/nav.csv", package = "flows"))
# Prepare data
myflows <- prepare_mat(x = nav, i = "i", j = "j", fij = "fij")
myflows[1:5, 1:5]

rCarto/flows documentation built on May 10, 2024, 11:38 a.m.