Skip to contents

Features are matched by name when two versions are compared, so a feature that changed its name looks like one removed and one added, and its links drop out of the comparison. vp_rename() gives the features of a version the names they have in the other one, before comparing (it does what the option --rename of the command strong4vm diff does). vp_rename_candidates() suggests the renames.

Usage

vp_rename(model, renames)

Arguments

model

A model, from vp_generate() or vp_read().

renames

The renames: a named character vector (c(old = "new")), a data frame with the columns old and new (such as the answer of vp_rename_candidates()), or the path of a file with one rename per line (the old name, a space, the new name; a tab instead of the space when a name has spaces; lines that start with # and empty lines are ignored), such as the file that vp_rename_candidates() writes.

Value

The model with the features renamed in its features, graphs and atomic sets. A rename whose old name is not a feature of the model changes nothing, with a warning.

Examples

old <- vp_generate(vp_example("miband3_planned_old.uvl"), or_graph = TRUE)
new <- vp_generate(vp_example("miband3_realized.uvl"), or_graph = TRUE)
vp_compare(old, new) # BLEv40Old and BLEv40 look different
#> # A tibble: 3 × 10
#>   graph     kept added removed old_links new_links gained  lost jaccard spearman
#>   <chr>    <int> <int>   <int>     <int>     <int>  <int> <int>   <dbl>    <dbl>
#> 1 requires    10     1       1        10        17      7     0   0.588    0.922
#> 2 excludes    10     1       1         1         8      7     0   0.125   NA    
#> 3 atleast…    10     1       1         0         3      3     0   0       NA    
vp_compare(vp_rename(old, c(BLEv40Old = "BLEv40")), new)
#> # A tibble: 3 × 10
#>   graph     kept added removed old_links new_links gained  lost jaccard spearman
#>   <chr>    <int> <int>   <int>     <int>     <int>  <int> <int>   <dbl>    <dbl>
#> 1 requires    11     0       0        10        21     11     0   0.476    0.867
#> 2 excludes    11     0       0         3        10      7     0   0.3     NA    
#> 3 atleast…    11     0       0         0         3      3     0   0       NA