% if(n_total > 0) { %>
Dependency plot
<% tmp_file = tempfile(fileext = ".png")
if(nrow(rev_tb) > 5) {
png(tmp_file, width = 1200*1.5, height = 500*1.5, res = 72*2)
l = df$package == pkg$package
repo = ifelse(grepl("bioconductor", df$repository), "Bioconductor", "CRAN")
color = ifelse(l, "highlight", "no")
suppressMessages(suppressWarnings({
p1 = ggplot2::ggplot(df, ggplot2::aes(n_children, heaviness_on_children, pch = repo, color = color, label = ifelse(l, df$package, ""))) +
ggplot2::geom_point() +
ggplot2::scale_color_manual(values = c("highlight" = "red", "no" = "grey")) +
ggplot2::scale_shape_manual(values = c("Bioconductor" = 16, "CRAN" = 4)) +
ggplot2::scale_x_continuous(trans='log10') +
ggrepel::geom_text_repel(min.segment.length = 0, box.padding = 0.5, max.overlaps = Inf, show.legend = FALSE, size =3) +
ggplot2::labs(x = "Number of child packages", y = "Heaviness") +
ggplot2::ggtitle("Heaviness on child packages")
p2 = ggplot2::ggplot(rev_tb, ggplot2::aes(heaviness)) + geom_histogram() +
ggplot2::labs(x = "Number of child packages", y = "Frequency") +
ggplot2::ggtitle(qq("Histogram of heaviness of '@{pkg$package}' on its child packages"))
print(cowplot::plot_grid(p1, p2, rel_widths = c(1.2, 1)))
}))
dev.off()
} else {
png(tmp_file, width = 600*1.5, height = 600*1.5, res = 72*1.5)
l = df$package == pkg$package
repo = ifelse(grepl("bioconductor", df$repository), "Bioconductor", "CRAN")
color = ifelse(l, "highlight", "no")
suppressWarnings({
p1 = ggplot2::ggplot(df, ggplot2::aes(n_children, heaviness_on_children, pch = repo, color = color, label = ifelse(l, df$package, ""))) +
ggplot2::geom_point() +
ggplot2::scale_color_manual(values = c("highlight" = "red", "no" = "grey")) +
ggplot2::scale_shape_manual(values = c("Bioconductor" = 16, "CRAN" = 4)) +
ggplot2::scale_x_continuous(trans='log10') +
ggrepel::geom_text_repel(min.segment.length = 0, box.padding = 0.5, max.overlaps = Inf, show.legend = FALSE, size =3) +
ggplot2::labs(x = "Number of children packages", y = "Heaviness") +
ggplot2::ggtitle("Heaviness on child packages")
ggplot2:::print.ggplot(p1)
})
dev.off()
}
%>
<%= img(tmp_file, style="height:500px")%>
<% file.remove(tmp_file) %>
In total there are <%=n_total%> child packages, only <%=n_used%> child packages with heaviness on '<%=pkg$package%>' larger than 10 are listed in the following table.
imports: number of imported functions/variables; importMethods: number of imported S4 methods; importClasses: number of imported S4 classes.
<% rev_tb$package = qq("@{rev_tb$package}", collapse = FALSE) rev_tb = cbind(rev_tb[, 1:5], "namespace" = qq("link", collapse = FALSE), rev_tb[, 6, drop = FALSE]) html_rev_tb = as.character(knitr::kable(rev_tb, format = "html", row.names = FALSE, escape = FALSE, col.names = c("Child package", "Field", "imports", "importMethods", "importClasses", "Namespace file", "Heaviness"), table.attr = "class='table table-striped'")) html_rev_tb = gsub("(In total there are <%=n_total%> children dependencies, but no package that '<%=pkg$package%>' has heaviness larger than 10 on it.
<% } %> <% } else { %>No children dependency found
<% } %>