<% if(n_total > 0) { %> <% if(grepl("(bioc|books|annotation|experiment|workflow)", pkg$repository)) { namespace_link = paste0("https://code.bioconductor.org/browse/", pkg$package, "/blob/master/NAMESPACE") } else if(pkg$package %in% BASE_PKGS) { namespace_link = paste0("https://github.com/wch/r-source/blob/trunk/src/library/", pkg$package, "/NAMESPACE") } else { namespace_link = paste0("https://github.com/cran/", pkg$package, "/blob/master/NAMESPACE") } %>

"Imports" information is from the NAMESPACE file of <%=pkg$package%>.

imports: number of imported functions/objects; importMethods: number of imported S4 methods; importClasses: number of imported S4 classes.

Total required packages: number of total dependency packages that a parent package brings in.

Heaviness on <%=pkg$package%>: number of extra dependency packages that a parent uniquely imported to <%=pkg$package%>.

The full table can be obtained by parent_dependency('<%=pkg$package%>').

<% tb[, 1] = qq("@{tb[, 1]}", collapse = FALSE) html_tb = as.character(knitr::kable(tb, format = "html", row.names = FALSE, escape = FALSE, col.names = c("Parent package", "Field", "imports", "importMethods", "importClasses", "Total required packages", qq("Heaviness on @{pkg$package}")), table.attr = "class='table table-striped' id='parent-dependency'", align = c("l", rep("r", ncol(tb) - 1)))) html_tb = gsub("(]*?> Suggests \\s+)]*?> 0 \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1No object is imported into the namespace of @{pkg$package}.\n"), html_tb) html_tb = gsub("(]*?> Enhances \\s+)]*?> 0 \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1No object is imported into the namespace of @{pkg$package}.\n"), html_tb) html_tb = gsub("(]*?> Depends \\s+)]*?> 0 \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1The whole set of functions/methods/classes from parent package is imported to the namespace of @{pkg$package}.\n"), html_tb) html_tb = gsub("(]*?> Depends \\s+)]*?> -(\\d+) \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1The whole set of functions/methods/classes from parent package excluding \\2 objects is imported to the namespace of @{pkg$package}.\n"), html_tb) html_tb = gsub("(]*?> Depends \\s+)]*?> -Inf \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1Parent package is listed in Depends of @{pkg$package} but no object from parent package is imported.\n"), html_tb) html_tb = gsub("(]*?> Imports \\s+)]*?> 0 \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1The whole set of functions/methods/classes from parent package is imported to the namespace of @{pkg$package}.\n"), html_tb) html_tb = gsub("(]*?> Imports \\s+)]*?> -(\\d+) \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1The whole set of functions/methods/classes from parent package excluding \\2 objects is imported to the namespace of @{pkg$package}.\n"), html_tb) html_tb = gsub("(]*?> Imports \\s+)]*?> -Inf \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1Parent package is listed in Imports of @{pkg$package} but no object from parent package is imported.\n"), html_tb) html_tb = gsub("(]*?> LinkingTo \\s+)]*?> 0 \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1No object is imported into the namespace of @{pkg$package}.\n"), html_tb) html_tb = gsub("(]*?> LinkingTo \\s+)]*?> -(\\d+) \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1The whole set of functions/methods/classes from parent package excluding \\2 objects is imported to the namespace of @{pkg$package}.\n"), html_tb) html_tb = gsub("(]*?> LinkingTo \\s+)]*?> -Inf \\s+]*?> 0 \\s+]*?> 0 \\s+", qq("\\1Parent package is listed in LinkingTo of @{pkg$package} but no object from parent package is imported.\n"), html_tb) %> <%= html_tb %> <% nr = n_total if(nr > records_per_page) { %> <%= page_select2(page, ceiling(nr/records_per_page), "parent_dependency", pkg$package) %> <% } %> <% m = co_heaviness(pkg) if(nrow(m) > 1) { if(attr(m, "max") > 10) { m2 = co_heaviness(pkg, jaccard = TRUE) pair1 = NULL pair2 = NULL hv1 = NULL hv2 = NULL nr = nrow(m) for(i in 1:(nr-1)) { for(j in (i+1):nr) { if(m[i, j] > 10) { pair1 = c(pair1, rownames(m)[i]) pair2 = c(pair2, rownames(m)[j]) hv1 = c(hv1, m[i, j]) hv2 = c(hv2, m2[i, j]) } } } relation = rep("", length(pair1)) for(i in seq_along(pair1)) { v = "not-clear" p = c(pair1[i], pair2[i]) if(length(p)) { if(is_parent(p[1], p[2])) { v = "parent-child" } else if(is_parent(p[2], p[1])) { v = "parent-child" } else if(is_upstream(p[1], p[2])) { v = "upstream-downstream" } else if(is_parent(p[2], p[1])) { v = "upstream-downstream" } else { up1 = heaviness_from_upstream(p[1]) up2 = heaviness_from_upstream(p[2]) # the max heaviness of common upstream max = attr(m, "max") cn = intersect(names(up1[up1 > max*0.75]), names(up2[up2 > max*0.75])) if(length(cn)) { v = "have-common-upstream" } } } relation[i] = v } co_tb = data.frame(pair1 = qq("@{pair1}", collapse = FALSE), pair2 = qq("@{pair2}", collapse = FALSE), relation = relation, heaviness = hv1, jaccard = round(hv2, 3)) co_tb = co_tb[order(co_tb$heaviness, decreasing = TRUE), , drop = FALSE] %>

The following table lists pairs of parent packages with co-heaviness larger than 10. The co-heaviness measures the number of additional dependencies that two parent packages simultaneously import and are only imported by the two parents.

Note the co-heaviness from parents can be always easily observed from the dependency heatmap.

<%= as.character(knitr::kable(co_tb, format = "html", row.names = FALSE, escape = FALSE, col.names = c("Parent 1", "Parent 2", "Relation of two parents", qq("Co-heaviness on @{pkg$package}"), "Co-heaviness as Jaccard coeffcient"), table.attr = "class='table table-striped' style='width:1000px'", align = c("l", "l", "r", "r", "r") )) %>

Denote the heaviness from parent A on P as $h_A$, the heaviness from parent B on P as $h_B$, and the co-heaviness from A and B as $h_{co}$, the Jaccard coeffcient is calculated as: $h_{co}/(h_{co} + h_A + h_B)$.

<% } } %> <% } else { %>

No parent dependency found.

<% } %>