#' Summarize veritas data information
#'
#' Print the number of participants, locations, people, groups and relations
#' in the whole veritas data base
#'
#' This is method of the [summary()] generic function.
#' Print on the Command Line Interface summary information.
#'
#' @param object Object of class `veritas.split` generate by [transformData()]
#' @param ... Only used to remain consistent with plot generic function
#'
#' @return NULL
#'
#' @export
summary.veritas.split <- function(object, ...){
# Extract count
nb_participants <- length(object)
nb_locations <- attr(object, "nb_locations")
nb_people <- attr(object, "nb_people")
nb_groups <- attr(object, "nb_groups")
nb_relations <- attr(object, "nb_relations")
# Print summary
cli::cli_text("{nb_participants} participants")
cli::cli_text("{nb_locations} locations")
cli::cli_text("{nb_people} people")
cli::cli_text("{nb_groups} groups")
cli::cli_text("{nb_relations} relations")
}
#' Summarize veritas data information for a single participant.
#'
#' Print the number of locations, people, groups and relations
#' of a single participant
#'
#' @param object An Object of class `veritas.pid`, which
#' is an element of the list generated by [transformData()].
#' @param ... Only used to remain consistent with plot generic function
#'
#' @return NULL
#'
#' @export
summary.veritas.pid <- function(object, ...){
# Extract pid
pid <- object$locations$pid
# Extract count
nb_locations <- length(object$locations$location_id)
nb_people <- length(object$people$people_id)
nb_groups <- length(object$groups$group_id)
if(!is.null(object$relations)) {
nb_relations_people <- object$relations %>%
subset(object$relations$relation_type == 1) %>%
nrow()
nb_relations_groups <- object$relations %>%
subset(object$relations$relation_type == 2) %>%
nrow()
nb_relations_locations <- object$relations %>%
subset(object$relations$relation_type == 3) %>%
nrow()
} else {
nb_relations_people <- 0
nb_relations_groups <- 0
nb_relations_locations <- 0
}
# Print
cli::cli_h2("participant")
cli::cli_text("pid: {pid}")
cli::cli_h2("nodes")
cli::cli_text("{nb_locations} locations")
cli::cli_text("{nb_people} people")
cli::cli_text("{nb_groups} groups")
cli::cli_h2("relations")
cli::cli_text("{nb_relations_people} people <--> people")
cli::cli_text("{nb_relations_groups} people <--> group")
cli::cli_text("{nb_relations_locations} people/group <--> locations")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.