View source: R/compare_weights.R
| merge_weights | R Documentation |
Joins a named list of edge tables (for instance the result of
compute_couplings()) by pair of nodes, with one column of weights per
element, and, by default, the rank of each pair under each measure and the
gap between the ranks of two measures. It is the table behind the other
comparison functions, and the tool to inspect the pairs on which two
measures disagree.
merge_weights(
edges,
rank = TRUE,
rank_gap = NULL,
ties = c("average", "min", "max", "first")
)
edges |
A named list of edge tables, each with the columns |
rank |
Logical. If |
rank_gap |
Character vector of two names of |
ties |
How ties are ranked, as in |
Weights of different measures do not have the same scale, but their ranks do: rank 1 is the strongest pair of the measure. A pair with a high weight for one measure and a low weight for another has a large gap between the two ranks. The gap is
\mathrm{rank\_gap}_{AB} = \mathrm{rank}_{2}(A, B) - \mathrm{rank}_{1}(A, B)
with 1 and 2 the first and second elements of rank_gap: it is positive
when the second measure ranks the pair lower (as less close) than the
first one, negative when it ranks it higher. Sorting the table on the gap
(decreasing, then increasing) gives the pairs on which the measures
disagree the most.
Ranks are computed on the pairs present in all the tables, so that they
are comparable: the pairs that a measure does not have (for instance
those of coupling_descriptive(), which links documents that share no
reference) get NA ranks.
A data.table with Source, Target, one column of weights per
element of edges and, according to the arguments, the rank_<name>
columns and rank_gap. A pair absent from a table (for instance because
tables were built with different thresholds) gets NA.
Other tools to compare coupling measures:
compute_couplings(),
correlate_weights(),
overlap_top_weights(),
plot_weights(),
summarise_weights()
library(biblionetwork)
edges <- compute_couplings(Ref_stagflation, "Citing_ItemID_Ref", "ItemID_Ref",
methods = c("angle", "strength"), weight_threshold = 2)
merged <- merge_weights(edges)
head(merged)
# The pairs that the angle ranks high and the strength ranks low
head(merged[order(-rank_gap)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.