Skip to content

Commit

Permalink
Vignette updates (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
bburns632 authored Apr 15, 2024
1 parent dc8d105 commit 25964cf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 50 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ License: BSD_3_clause + file LICENSE
URL: https://github.com/uptake/pkgnet, https://uptake.github.io/pkgnet/
BugReports: https://github.com/uptake/pkgnet/issues
RoxygenNote: 7.1.0
Roxygen: list(r6 = FALSE)
Roxygen: list(r6 = FALSE)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
YEAR: 2018
YEAR: 2018-2024
COPYRIGHT HOLDER: Uptake Technologies Inc.
ORGANIZATION: Uptake Technologies Inc.
63 changes: 15 additions & 48 deletions vignettes/pkgnet-intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,6 @@ knitr::opts_chunk$set(
)
```

<!-- STYLE SET UP FOR TWO COLUMN SECTIONS -->

```{=html}
<style>
.row:after {
content: "";
display: table;
clear: both;
}
.column-left{
float: left;
width: 48%;
text-align: justify;
text-justify: inter-word;
margin-right: 4%;
}
.column-right{
float: right;
width: 48%;
text-align: justify;
text-justify: inter-word;
}
</style>
```
<!-- CODE BELOW HERE WILL RENDER -->

`pkgnet` is an R package designed for the analysis of R packages! The goal of the package is to build graph representations of a package's various types of dependencies. This can inform a variety of activities, including:

- prioritizing functions to unit test based on their centrality or influence
Expand All @@ -69,7 +43,7 @@ knitr::opts_chunk$set(

Below is a brief tour of `pkgnet` and its features.

------------------------------------------------------------------------
***

# Packages as a Graph

Expand Down Expand Up @@ -129,7 +103,7 @@ In the example dependency graph above:

Following the direction of the edges allows you to figure out the **dependencies** of a node---the other nodes that it depends on. On the flip side, tracing the edges backwards allows you to figure out the **reverse dependencies** (i.e., dependents) of a node---the other nodes that depend on it.

------------------------------------------------------------------------
***

# Running pkgnet

Expand All @@ -154,7 +128,7 @@ report2 <- CreatePackageReport(
)
```

------------------------------------------------------------------------
***

# The HTML Report & Returned Object

Expand Down Expand Up @@ -188,11 +162,11 @@ Here's how the **Function Network Visualization** looks for `baseballstats`. No

<!-- SIDE BY SIDE START -->

::: row
<!-- Div to Wrap columns -->
:::: {style="content: ''; display: table; clear: both;"}

::: {style="float:left;width: 48%;text-align: justify;text-justify: inter-word;margin-right: 4%;"}

::: column-left
#### Default
**Default**

```{r demoVis1, fig.height=3, message=FALSE, warning=FALSE, echo=FALSE}
pkgnet:::silence_logger()
Expand All @@ -215,12 +189,12 @@ g
All functions and their dependencies are visible. For example, we can see that both `batting_avg` and `slugging_avg` functions depend upon the `at_bats` function.

We also see that nothing depends on the `on_base_pct` function. This might be valuable information to an R package developer.

:::

<!-- End column-left -->
::: {style="float: right; width: 48%; text-align: justify; text-justify: inter-word;"}

::: column-right
#### With Coverage Information
**With Coverage Information**

```{r demoVis2, fig.height=3, message=FALSE, warning=FALSE, echo=FALSE}
pkgnet:::silence_logger()
Expand Down Expand Up @@ -249,10 +223,8 @@ Same as the default visualization except we can see coverage information as well
It appears the function with the most dependencies, `at_bats`, is well covered. However, no other functions are covered by unit tests.
:::

<!-- End column-right -->
:::

<!-- End Div to Wrap columns --> <!-- SIDE BY SIDE END -->
::::
<!-- SIDE BY SIDE END -->

### Node Measures

Expand All @@ -263,16 +235,11 @@ Metrics for the nodes (either packages, functions, or classes depending on the r
report2 <- list(FunctionReporter = funcReporter2)
```

```{r nodes, eval=FALSE}
```{r nodes}
colSubset <- c('node','type','betweenness','outDegree','inDegree','numRecursiveDeps')
report2$FunctionReporter$nodes[,..colSubset]
```

```{r nodesFormatted, message=FALSE, warning=FALSE, echo=FALSE}
colSubset <- c('node','type','betweenness','outDegree','inDegree','numRecursiveDeps')
knitr::kable(report2$FunctionReporter$nodes[,..colSubset])
```

Note, a few of these metrics provided by default are from the field of [Network Theory](https://en.wikipedia.org/wiki/Network_theory). You can leverage the _Network Graph Model Object_ described below to derive many more.

### Network Measures
Expand All @@ -295,7 +262,7 @@ report2$FunctionReporter$pkg_graph$node_measures(c('hubScore', 'authorityScore')
report2$FunctionReporter$pkg_graph$igraph
```

------------------------------------------------------------------------
***

# A Deeper Look

Expand Down Expand Up @@ -431,7 +398,7 @@ utils::remove.packages(
unlink(testLibPath)
```

------------------------------------------------------------------------
***

# More Information

Expand Down

0 comments on commit 25964cf

Please sign in to comment.