Skip to content

Commit

Permalink
Merge pull request #245 from snlab-ch/develop
Browse files Browse the repository at this point in the history
v0.11.3
  • Loading branch information
jhollway authored Sep 13, 2022
2 parents 20939df + 9b0d233 commit a916526
Show file tree
Hide file tree
Showing 50 changed files with 94 additions and 71 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: migraph
Title: Tools for Multimodal Network Analysis
Version: 0.11.2
Date: 2022-09-10
Version: 0.11.3
Date: 2022-09-13
Description: A set of tools for analysing multimodal networks.
All functions operate with matrices, edge lists,
and 'igraph', 'network', and 'tidygraph' objects,
Expand Down Expand Up @@ -53,7 +53,7 @@ Suggests:
Authors@R:
c(person(given = "James",
family = "Hollway",
role = c("cph", "cre", "aut", "ctb"),
role = c("cre", "aut", "ctb"),
email = "james.hollway@graduateinstitute.ch",
comment = c("IHEID", ORCID = "0000-0002-8361-9647")),
person(given = "Jael",
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# migraph 0.11.3

## Package

- Fixed CRAN LaTeX issue relating to underscores in manual figures

## Mapping

- Fixed bug in plotting space coordinates for named two-mode networks
- Suppressed messages relating to 'graph' class being defined by multiple packages

# migraph 0.11.2

## Package
Expand Down
54 changes: 27 additions & 27 deletions R/data_ison.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
#' (autographr(ison_bb) | autographr(ison_bm) | autographr(ison_mm) | autographr(ison_mb))/
#' (autographr(to_mode1(ison_mm)) | autographr(to_mode1(ison_mm)) |
#' autographr(to_mode1(ison_mm)) | autographr(to_mode1(ison_mm)))
#' ggsave("man/figures/ison_proj.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/ison_proj.pdf", width = 7, height = 3.5)
#' ggsave("man/figures/isonproj.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/isonproj.pdf", width = 7, height = 3.5)
#' ```
#' \if{html}{\figure{ison_proj.png}{options: width="100\%" alt="Figure: ison_proj"}}
#' \if{latex}{\figure{ison_proj.pdf}{options: width=7cm}}
#' \if{html}{\figure{isonproj.png}{options: width="100\%" alt="Figure: ison_proj"}}
#' \if{latex}{\figure{isonproj.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name ison_projection
Expand Down Expand Up @@ -94,11 +94,11 @@
#'
#' ```{r, eval = FALSE, echo = FALSE, include = FALSE}
#' autographr(ison_algebra, labels = FALSE) + ggtitle("ison_algebra")
#' ggsave("man/figures/ison_algebra.png", width = 5, height = 5, dpi = "screen")
#' ggsave("man/figures/ison_algebra.pdf", width = 5, height = 5)
#' ggsave("man/figures/isonalgebra.png", width = 5, height = 5, dpi = "screen")
#' ggsave("man/figures/isonalgebra.pdf", width = 5, height = 5)
#' ```
#' \if{html}{\figure{ison_algebra.png}{options: width="75\%" alt="Figure: ison_algebra"}}
#' \if{latex}{\figure{ison_algebra.pdf}{options: width=7cm}}
#' \if{html}{\figure{isonalgebra.png}{options: width="75\%" alt="Figure: ison_algebra"}}
#' \if{latex}{\figure{isonalgebra.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name ison_algebra
Expand All @@ -121,11 +121,11 @@
#'
#' ```{r, eval = FALSE, echo = FALSE, include = FALSE}
#' autographr(ison_adolescents, labels = FALSE) + ggtitle("ison_adolescents")
#' ggsave("man/figures/ison_adolescents.png", width = 5, height = 5, dpi = "screen")
#' ggsave("man/figures/ison_adolescents.pdf", width = 5, height = 5)
#' ggsave("man/figures/isonadolescents.png", width = 5, height = 5, dpi = "screen")
#' ggsave("man/figures/isonadolescents.pdf", width = 5, height = 5)
#' ```
#' \if{html}{\figure{ison_adolescents.png}{options: width="75\%" alt="Figure: ison_adolescents"}}
#' \if{latex}{\figure{ison_adolescents.pdf}{options: width=7cm}}
#' \if{html}{\figure{isonadolescents.png}{options: width="75\%" alt="Figure: ison_adolescents"}}
#' \if{latex}{\figure{isonadolescents.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name ison_adolescents
Expand Down Expand Up @@ -159,11 +159,11 @@
#'
#' ```{r, eval = FALSE, echo = FALSE, include = FALSE}
#' autographr(ison_karateka) + ggtitle("ison_karateka")
#' ggsave("man/figures/ison_karateka.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/ison_karateka.pdf", width = 7, height = 3.5)
#' ggsave("man/figures/isonkarateka.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/isonkarateka.pdf", width = 7, height = 3.5)
#' ```
#' \if{html}{\figure{ison_karateka.png}{options: width="75\%" alt="Figure: ison_karateka"}}
#' \if{latex}{\figure{ison_karateka.pdf}{options: width=7cm}}
#' \if{html}{\figure{isonkarateka.png}{options: width="75\%" alt="Figure: ison_karateka"}}
#' \if{latex}{\figure{isonkarateka.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name ison_karateka
Expand Down Expand Up @@ -191,10 +191,10 @@
#'
#' ```{r, eval = FALSE, echo = FALSE, include = FALSE}
#' autographr(ison_networkers, labels = FALSE) + ggtitle("ison_networkers")
#' ggsave("man/figures/ison_networkers.png", width = 5, height = 5, dpi = "screen")
#' ggsave("man/figures/ison_networkers.pdf", width = 5, height = 5)
#' ggsave("man/figures/isonnetworkers.png", width = 5, height = 5, dpi = "screen")
#' ggsave("man/figures/isonnetworkers.pdf", width = 5, height = 5)
#' ```
#' \if{latex}{\figure{ison_networkers.pdf}{options: width=7cm}}
#' \if{latex}{\figure{isonnetworkers.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name ison_networkers
Expand Down Expand Up @@ -223,11 +223,11 @@
#'
#' ```{r, eval = FALSE, echo = FALSE, include = FALSE}
#' autographr(ison_brandes) + ggtitle("ison_brandes") + autographr(ison_brandes2)
#' ggsave("man/figures/ison_brandes.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/ison_brandes.pdf", width = 7, height = 3.5)
#' ggsave("man/figures/isonbrandes.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/isonbrandes.pdf", width = 7, height = 3.5)
#' ```
#' \if{html}{\figure{ison_brandes.png}{options: width="100\%" alt="Figure: ison_brandes"}}
#' \if{latex}{\figure{ison_brandes.pdf}{options: width=7cm}}
#' \if{html}{\figure{isonbrandes.png}{options: width="100\%" alt="Figure: ison_brandes"}}
#' \if{latex}{\figure{isonbrandes.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name ison_brandes
Expand Down Expand Up @@ -257,11 +257,11 @@
#'
#' ```{r, eval = FALSE, echo = FALSE, include = FALSE}
#' autographr(ison_southern_women, "hierarchy", labels = FALSE) + ggtitle("ison_southern_women")
#' ggsave("man/figures/ison_southern_women.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/ison_southern_women.pdf", width = 7, height = 3.5)
#' ggsave("man/figures/isonsouthernwomen.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/isonsouthernwomen.pdf", width = 7, height = 3.5)
#' ```
#' \if{html}{\figure{ison_southern_women.png}{options: width="75\%" alt="Figure: ison_southern_women"}}
#' \if{latex}{\figure{ison_southern_women.pdf}{options: width=7cm}}
#' \if{html}{\figure{isonsouthernwomen.png}{options: width="75\%" alt="Figure: ison_southern_women"}}
#' \if{latex}{\figure{isonsouthernwomen.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name ison_southern_women
Expand Down
16 changes: 8 additions & 8 deletions R/data_mpn.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#'
#' ```{r, eval = FALSE, echo = FALSE, include = FALSE}
#' autographr(mpn_elite_mex, labels = FALSE) + ggtitle("mpn_elite_mex")
#' ggsave("man/figures/mpn_elite_mex.png", width = 5, height = 5, dpi = "screen")
#' ggsave("man/figures/mpn_elite_mex.pdf", width = 5, height = 5)
#' ggsave("man/figures/mpnelitemex.png", width = 5, height = 5, dpi = "screen")
#' ggsave("man/figures/mpnelitemex.pdf", width = 5, height = 5)
#' ```
#' \if{html}{\figure{mpn_elite_mex.png}{options: width="100\%" alt="Figure: mpn_elite_mex"}}
#' \if{latex}{\figure{mpn_elite_mex.pdf}{options: width=7cm}}
#' \if{html}{\figure{mpnelitemex.png}{options: width="100\%" alt="Figure: mpn_elite_mex"}}
#' \if{latex}{\figure{mpnelitemex.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name mpn_elite_mex
Expand Down Expand Up @@ -63,11 +63,11 @@
#' ```{r, eval = FALSE, echo = FALSE, include = FALSE}
#' autographr(mpn_elite_usa_advice, labels = FALSE) + ggtitle("mpn_elite_usa_advice") +
#' autographr(mpn_elite_usa_money, labels = FALSE) + ggtitle("mpn_elite_usa_money")
#' ggsave("man/figures/mpn_elite_usa.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/mpn_elite_usa.pdf", width = 7, height = 3.5)
#' ggsave("man/figures/mpneliteusa.png", width = 7, height = 3.5, dpi = "screen")
#' ggsave("man/figures/mpneliteusa.pdf", width = 7, height = 3.5)
#' ```
#' \if{html}{\figure{mpn_elite_usa.png}{options: width="100\%" alt="Figure: mpn_elite_usa"}}
#' \if{latex}{\figure{mpn_elite_usa.pdf}{options: width=7cm}}
#' \if{html}{\figure{mpneliteusa.png}{options: width="100\%" alt="Figure: mpn_elite_usa"}}
#' \if{latex}{\figure{mpneliteusa.pdf}{options: width=7cm}}
#' @docType data
#' @keywords datasets
#' @name mpn_elite_usa
Expand Down
2 changes: 1 addition & 1 deletion R/measure_diversity.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ NULL
#' Gibbs-Martin index, and probability of interspecific encounter (PIE)):
#' \deqn{1 - \sum\limits_{i = 1}^k {p_i^2 }},
#' where \eqn{p_i} is the proportion of group members in \eqn{i}th category
#' and _k_ is the number of categories for an attribute of interest.
#' and \eqn{k} is the number of categories for an attribute of interest.
#' This index can be interpreted as the probability that two members
#' randomly selected from a group would be from different categories.
#' This index finds its minimum value (0) when there is no variety,
Expand Down
8 changes: 4 additions & 4 deletions R/viz_autographr.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ autographr <- auto_graph <- function(object,
repel = TRUE)
} else { # Plot two modes
p <- p + ggraph::geom_node_text(ggplot2::aes(label = name),
size = 2,
hjust = "outward",
nudge_x = ifelse(lo[,1] == 1, 0.05, -0.05)) +
ggplot2::coord_cartesian(xlim=c(-0.2,1.2))
repel = TRUE,
size = 2,
hjust = "outward",
nudge_x = ifelse(lo[,1] == 1, 0.05, -0.05))
}
}

Expand Down
8 changes: 4 additions & 4 deletions R/viz_layout_partition.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ layout_tbl_graph_hierarchy <- function(object,
}
if(any(prep<0)) prep[prep<0] <- 0
out <- as_graphAM(prep)
out <- Rgraphviz::layoutGraph(out, layoutType = 'dot',
attrs = list(graph = list(rankdir = "BT")))
out <- suppressMessages(Rgraphviz::layoutGraph(out, layoutType = 'dot',
attrs = list(graph = list(rankdir = "BT"))))
nodeX <- .rescale(out@renderInfo@nodes$nodeX)
nodeY <- .rescale(out@renderInfo@nodes$nodeY)
# nodeY <- abs(nodeY - max(nodeY))
Expand All @@ -61,8 +61,8 @@ layout_tbl_graph_alluvial <- function(object,
}
if(any(prep<0)) prep[prep<0] <- 0
out <- as_graphAM(prep)
out <- Rgraphviz::layoutGraph(out, layoutType = 'dot',
attrs = list(graph = list(rankdir = "LR")))
out <- suppressMessages(Rgraphviz::layoutGraph(out, layoutType = 'dot',
attrs = list(graph = list(rankdir = "LR"))))
nodeX <- .rescale(out@renderInfo@nodes$nodeX)
nodeY <- .rescale(out@renderInfo@nodes$nodeY)
# nodeY <- abs(nodeY - max(nodeY))
Expand Down
7 changes: 6 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ as well as with objects constructed from the following packages:
`{migraph}`'s `as_*()` functions can be used to translate objects
from one of the above classes into any other, and include:

- `r list_functions("^as_")`
```{r coercion-graph, echo = FALSE}
autographr(igraph::graph_from_literal(edgelist:matrix:igraph:network:tidygraph+--+edgelist:matrix:igraph:network:tidygraph,
edgelist:matrix:igraph:network:tidygraph--+graphAM,
siena:goldfish--+edgelist:matrix:igraph:network:tidygraph:graphAM),
"circle", node_size = 2)
```

These functions are designed to be as intuitive and lossless as possible,
outperforming many other class-coercion packages.
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ as well as with objects constructed from the following packages:
`{migraph}`’s `as_*()` functions can be used to translate objects from
one of the above classes into any other, and include:

- `as_edgelist()`, `as_graphAM()`, `as_igraph()`, `as_matrix()`,
`as_network()`, `as_tidygraph()`
<img src="man/figures/README-coercion-graph-1.png" width="100%" />

These functions are designed to be as intuitive and lossless as
possible, outperforming many other class-coercion packages.
Expand Down
4 changes: 2 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Test environments

* local R installation, x86_64-apple-darwin17.0, R 4.2.0
* local R installation, x86_64-apple-darwin17.0, R 4.2.1
* Mac OS X 11.6.5 (on Github), R 4.2.1
* Microsoft Windows Server 2022 10.0.20348 (on Github), R 4.2.1
* Ubuntu 20.04.4 (on Github), R 4.2.1
Expand All @@ -9,4 +9,4 @@

0 errors | 0 warnings | 0 notes

- Fixed documentation issues
- Renamed figures for the PDF manual
2 changes: 1 addition & 1 deletion man/diversity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added man/figures/README-coercion-graph-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed man/figures/ison_algebra.png
Binary file not shown.
Binary file removed man/figures/ison_brandes.png
Binary file not shown.
Binary file removed man/figures/ison_karateka.png
Binary file not shown.
Binary file removed man/figures/ison_networkers.png
Binary file not shown.
Binary file removed man/figures/ison_proj.pdf
Binary file not shown.
Binary file removed man/figures/ison_proj.png
Binary file not shown.
Binary file removed man/figures/ison_southern_women.png
Binary file not shown.
Binary file not shown.
File renamed without changes
Binary file not shown.
Binary file added man/figures/isonalgebra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added man/figures/isonbrandes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added man/figures/isonkarateka.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added man/figures/isonnetworkers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/isonproj.pdf
Binary file not shown.
Binary file added man/figures/isonproj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added man/figures/isonsouthernwomen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed man/figures/mpn_elite_mex.png
Binary file not shown.
Binary file removed man/figures/mpn_elite_usa.png
Binary file not shown.
Binary file not shown.
Binary file added man/figures/mpnelitemex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added man/figures/mpneliteusa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions man/ison_adolescents.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ison_algebra.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ison_brandes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ison_karateka.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ison_networkers.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ison_projection.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ison_southern_women.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/mpn_elite_mex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/mpn_elite_usa.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tests/testthat/test-viz_autographr.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,11 @@ test_that("edge colours graph correctly", {
test_brandes2 <- autographr(ison_brandes2, edge_color = "tiecolour")
expect_false(is.null(test_brandes2$layers[[1]]$mapping$edge_colour))
})

# Named networks
test_that("named networks plot correctly", {
onemode <- autographr(ison_adolescents)
twomode <- autographr(ison_southern_women)
expect_equal(onemode[["data"]][["name"]], node_names(ison_adolescents))
expect_equal(twomode[["data"]][["name"]], node_names(ison_southern_women))
})

0 comments on commit a916526

Please sign in to comment.