Closed kippjohnson closed 5 years ago
checking tests ... ERROR
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
> library(ggnetwork)
Loading required package: ggplot2
>
> test_check("ggnetwork")
── 1. Failure: load_pkg works (@test-utilities.R#5) ───────────────────────────
`expect_warning(load_pkg(-999), "no package")` threw an error with unexpected message.
Expected match: "install the"
Actual message: "could not find function \"load_pkg\""
This doesn't seem related to my edits?
Hi @kippjohnson
First of all, all apologies for answering only now.
The problem is related, yet different from, #33.
My impression is that a simpler fix is available: see commit https://github.com/briatte/ggnetwork/commit/37e9e8a9f15dcb7d2f06ad25a692e3591c39b293.
This is what the fix looks like:
Still, your fix has the interesting property of precomputing diff(range(x))
, which we need for the rescaling, so it might actually be a bit faster.
I'll refactor the code to see what I come up with. I'll close the PR but add you as a contributor for this.
Thanks again, and so sorry for being very slow to take up your PR!
Alright, commit https://github.com/briatte/ggnetwork/commit/43a71144e6fc6690801e9dac84e688e50673bc96 does almost exactly what you recommended to do. Thanks again!
Thanks for your great work on this package! I was happy to help in whatever small way.
If we want to plot a network in a straight line such as 1 --> 2 --> 3 by passing in an xy layout matrix, ggnetwork breaks because the rescaling function used gives NaN. I added a simple scale2() function that deals with the special case where a column is constant by just setting all values in the column = 0.5.
See error example below:
Problematic lines of code in ggnetwork:::fortify.network() :
Simple fix: change the scale functions above to scale2(), defined here: