-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbackward_linkages.R
43 lines (36 loc) · 1.5 KB
/
backward_linkages.R
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
#' @title Backward linkages
#'
#' @description Indicate the interconnection of a particular sector to other sectors
#' from which it purchases inputs (demand side). When a sector increases its output,
#' it will increase the total (intermediate) demand on all other sectors, which is measured
#' by backward linkages.
#'
#' @details Backward linkages are defined as the column sum of the Leontief inverse,
#' in line with the Eurostat Manual of Supply, Use and
#' Input-Output Tables (see p506-507.) and the
#' Handbook on Supply and Use Tables and Input-Output Tables with Extensions and Applications of
#' the United Nations (see p636.)
#' @param Im A Leontief inverse matrix created by the
#' \code{\link{leontief_inverse_create}} function.
#' @return The vector of industry (product) backward linkages in a wide
#' data.frame class, following the column names of the Leontief
#' inverse matrix.
#' @importFrom dplyr mutate across
#' @family linkage functions
#' @examples
#' de_coeff <- input_coefficient_matrix_create( iotable_get(),
#' digits = 4 )
#' I <- leontief_inverse_create (de_coeff)
#' backward_linkages (I)
#' @export
backward_linkages <- function ( Im ) {
Im <- mutate (Im, across(where(is.factor), as.character))
total_row <- data.frame (
name = "backward linkages"
)
names(total_row)[1] <- names(Im[1])
total_row <- cbind ( total_row,
t(colSums(Im[,2:ncol(Im)]))
)
total_row
}