% if(n_total > 0) { %>
Dependency plot
<% tmp_file = tempfile(fileext = ".png")
if(nrow(downstream_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_downstream, heaviness_on_downstream, 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 downstream packages", y = "Heaviness") +
ggplot2::ggtitle("Heaviness on downstream packages")
p2 = ggplot2::ggplot(downstream_tb, ggplot2::aes(heaviness)) + geom_histogram() +
ggplot2::labs(x = "Number of downstream packages", y = "Frequency") +
ggplot2::ggtitle("Histogram of heaviness on downstream 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_downstream, heaviness_on_downstream, 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 downstream packages", y = "Heaviness") +
ggplot2::ggtitle("Heaviness on downstream packages")
ggplot2:::print.ggplot(p1)
})
dev.off()
}
%>
<%= img(tmp_file, style="height:500px")%>
<% file.remove(tmp_file) %>
In total there are <%=n_total%> downstream dependency packages, only <%=n_used%> downstream packages with heaviness on '<%=pkg$package%>' larger than 10 are listed in the following table.
<% el = downstream_dependency(pkg$package) g = igraph::graph.edgelist(as.matrix(unique(el[, 1:2]))) for(i in seq_len(nrow(downstream_tb))) { sp = igraph::all_shortest_paths(g, pkg$package, downstream_tb[i, 1])$res downstream_tb[i, "path"] = paste(sapply(sp, function(x) { p = names(x) txt = paste0("In total there are <%=n_total%> downstream dependencied, but no package has heaviness larger than 10.
<% } %> <% } else { %>No downstream dependency found
<% } %>