This is a convienience function for re-nesting the `tomtom` list column if the user unnests it. Additionally, it will update the best_match information based on the ranking of the resulting `tomtom` data.frame. This avoids having out-of-date best_match information after manipulating the `tomtom` entries.

nest_tomtom(data)

Arguments

data

tomtom results data.frame after unnesting the `tomtom` column

Value

the input data.frame with the match_* columns nested into a column named `tomtom`

Details

**NOTE:** that the resulting columns may not be in the same order, so operations like `identical()` before & after a nest/renest operation may fail even though the column values are unchanged.

Examples

if (meme_is_installed()){
motif <- universalmotif::create_motif("CCRAAAW")
db <- system.file("extdata/flyFactorSurvey_cleaned.meme", package = "memes")
res <- runTomTom(motif, database = db)
data <- tidyr::unnest(res, "tomtom")
identical(nest_tomtom(data), res)
}
#> [1] FALSE