#' See who add or detele a links in a article and when
#'
#' @param a A character vector containing wikilinks. Can be built with \code{page_content} and \code{parse_links}
#' @param b Same type of \code{a}, but to be compared.
#'
#' @return A data-frame with two colum. In the first one, the number of links that, being in a, are not present in b. In the second one, the number of links that being in b, are not being in a
#' @export
#'
#' @import dplyr
#' @importFrom magrittr %<>%
version_links <- function(a, b) {
# Distibution de a -------------------------------------------------------
dist_a <- table(a) %>% as.data.frame
names(dist_a) <- c("link", "freq.a")
dist_a$link %<>% as.character()
# Distribution de b -------------------------------------------------------
dist_b <- table(b) %>% as.data.frame
names(dist_b) <- c("link", "freq.b")
dist_b$link %<>% as.character()
# Distribution conjointe --------------------------------------------------
conjointe <- full_join(dist_a, dist_b, by = "link")
conjointe[is.na(conjointe)] <- 0
conjointe$diff <- conjointe$freq.b - conjointe$freq.a
# Résultat ----------------------------------------------------------------
data.frame(
deleted = sum(conjointe$diff[conjointe$diff < 0]),
added = sum(conjointe$diff[conjointe$diff > 0])
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.