Skip to content

Commit

Permalink
version 0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jhollway authored and cran-robot committed Sep 17, 2023
1 parent 81972a9 commit cbef293
Show file tree
Hide file tree
Showing 21 changed files with 186 additions and 72 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package: manynet
Title: Many Ways to Make, Manipulate, and Map Myriad Networks
Version: 0.2.1
Date: 2023-08-11
Version: 0.2.3
Date: 2023-09-17
Description: A set of tools for making, manipulating, and mapping many different types of networks.
All functions operate with matrices, edge lists, and 'igraph', 'network', and 'tidygraph' objects,
and on one-mode, two-mode (bipartite), and sometimes three-mode networks.
The package includes functions for importing and exporting, creating and generating networks,
molding and manipulating networks and node and tie attributes,
and describing and visualizing networks with sensible defaults.
URL: https://github.com/snlab-ch/manynet
URL: https://snlab-ch.github.io/manynet/
BugReports: https://github.com/snlab-ch/manynet/issues
Depends: R (>= 3.6.0)
License: MIT + file LICENSE
Expand All @@ -34,10 +34,10 @@ Authors@R:
comment = c("IHEID", ORCID = "0000-0003-3420-6085"))
)
NeedsCompilation: no
Packaged: 2023-08-11 13:07:02 UTC; hollway
Packaged: 2023-09-17 13:57:21 UTC; hollway
Author: James Hollway [cre, aut, ctb] (IHEID,
<https://orcid.org/0000-0002-8361-9647>),
Henrique Sposito [ctb] (IHEID, <https://orcid.org/0000-0003-3420-6085>)
Maintainer: James Hollway <james.hollway@graduateinstitute.ch>
Repository: CRAN
Date/Publication: 2023-08-11 13:40:06 UTC
Date/Publication: 2023-09-17 17:10:02 UTC
38 changes: 20 additions & 18 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
5682971c475d8f91198989f247d133f8 *DESCRIPTION
e3190dd093af516c23ca4fb0a72a4b11 *DESCRIPTION
361d71c6379f4ddf09ca9c8540b8fea1 *LICENSE
3ab8ea40ca6fbb3728177c8ca0f1255c *NAMESPACE
53e5898f3d3fc9f59be9822e0bdd9bda *NEWS.md
65446f8db7ac66243fe0e2bd445d6076 *R/data_ison.R
12671caf0c3008c3fc369a17afcd63c0 *NEWS.md
6bc2af6eaf65d3416ba0e39510b015d8 *R/data_ison.R
9022cd74ad3f3e6b31705c7555e23567 *R/make_as.R
280195557bbe3c28bd67cde1f5423490 *R/make_create.R
a59dcc247a1aa29833f174ec2529cb10 *R/make_generate.R
50f2dd264d63cab1914f5fbaaecdf5fc *R/make_read.R
ae917bc4b4e693789611337e6c17f0b3 *R/make_read.R
eaf9a4357387f0e949880e03221472dd *R/manip_add.R
53c02b0642c4c2bd507849f3a6f67eb3 *R/manip_from.R
e9aad6f23cbc1657f3281237185c8908 *R/manip_miss.R
Expand All @@ -16,7 +16,7 @@ c86f435854b50d81a7d318ba60ca7897 *R/manip_reformat.R
9fe01dbfe1df9c4b0e060de9713c6e2a *R/manip_transform.R
e6904ca7fa87c64684580f5b36e5896d *R/manynet-utils.R
5a485b8100c0667e5fdd249c345a4bff *R/map_attributes.R
f672ad16ae8ecdf382b6c2bfdcb2f065 *R/map_autographr.R
51cb43b3f9f00e069bbe2eecb61193f8 *R/map_autographr.R
262ac6411f46c6a8eea206024cfc863c *R/map_is.R
27ed31b66230cc7bdea828a439f57b6a *R/map_layout_partition.R
97a8d4d39163df53cbafb9a63b3d3610 *R/map_palettes.R
Expand All @@ -27,21 +27,22 @@ f672ad16ae8ecdf382b6c2bfdcb2f065 *R/map_autographr.R
33162022353ceac96f9282149c710d90 *R/reexports_classes.R
5b6bdf57abcbb9776d5b05ae9d0c1192 *R/reexports_ggplot2.R
c32b17bf67aaa82f9497832d48ffc8b1 *R/sysdata.rda
20c5d0ac9aba30fa26730845f310eb3a *README.md
439bf689fa27cf9affd0335332142165 *build/partial.rdb
9b86447ce1e63febc51e5c86eed764ce *README.md
7080893e02c49cd296d4424b9be55069 *build/partial.rdb
165a53aa74d16bf17d9476a4cdca3567 *data/ison_adolescents.rda
e5b3237a16d54a8fc774b8d8128fed39 *data/ison_algebra.rda
b20354b3d6f9fb3b4e65c511ed5db78a *data/ison_brandes.rda
41a221361a130d269ba1a91788ab2922 *data/ison_karateka.rda
8250e638e7ae6c2299e8f831eab0a82e *data/ison_konigsberg.rda
ffe9cca1f76c1fe8bc16265b57da49f7 *data/ison_laterals.rda
505933fd1de5c9d14040c28628fbc829 *data/ison_lawfirm.rda
93e366676084deeb1faa88333b54a6a3 *data/ison_lotr.rda
3d49ca0a38656ff2f38a9f8cb5bd3ef8 *data/ison_marvel_relationships.rda
0283024d033581ff0e9dcab5f05d0e54 *data/ison_marvel_teams.rda
c670cc2e0d2c9d2fb0f7be97c56ed735 *data/ison_marvel_relationships.rda
daa202d696a0ff4374a92d1927eb8572 *data/ison_marvel_teams.rda
e327b78dbf21f748a1fe54322c93e496 *data/ison_networkers.rda
b45178a091e0cdb0ab2ba12abaf63e4e *data/ison_southern_women.rda
a8b18fd3012e113ac1533d3e43e28d02 *inst/manynet.png
8316307638b5e9cbf37d88e864ab2b78 *inst/tutorials/tutorial1/data.Rmd
1e4ad271de7b80858e500d28faac01da *inst/tutorials/tutorial1/data.Rmd
fb00940f1411f89fe46a9c062a62fb81 *inst/tutorials/tutorial1/data.html
e6611f534f1efb2d9df7fb51777f93d9 *inst/tutorials/tutorial1/data/adols.csv
52bb5bccd9a3b7d3dbbc28794a9b64f8 *inst/tutorials/tutorial1/data/adols.net
Expand All @@ -52,31 +53,32 @@ dbd302bd9c1e2c921c6255d740ca5c0b *inst/tutorials/tutorial1/data/flonode.csv
2ed79662b1c293c0be2edceb47c1aa5d *inst/tutorials/tutorial2/visualisation_files/figure-html/maxbet-1.png
577785c00b8026d2e5400086537611cb *man/add.Rd
daadf1d5c685eba1af39e765c9a13ae6 *man/as.Rd
07182262c8dd174e4ba6657bc589d6cb *man/attributes.Rd
a00c21113d63e8f5b8ade9ba189a70db *man/auto_graph.Rd
560ca9f988383ba3ae099e8359255f33 *man/attributes.Rd
6e93fdc19b29d31cc6ee345db3d55190 *man/autographing.Rd
d820a2ec1e34da685561d025a0185fd0 *man/create.Rd
d2f6ba1c56e762bdd6893dd3e87b3386 *man/figures/README-coercion-graph-1.png
34076488ddf8d5fcab83b9b25dffc725 *man/figures/README-import-graph-1.png
4aa3a28863f403109d42ab15aa6534da *man/figures/README-layout-comparison-1.png
ca331d67c1914f18ff55433134498306 *man/figures/logo.png
955258e5212728cea3c637a208ce7fb6 *man/from.Rd
ec6f767d4a16ce9affc08e855ab399bd *man/generate.Rd
be0945ab0eea0c4e2efd09161317a5e8 *man/is.Rd
a6c9e89dbeeff154c581349b0d2fce0b *man/is.Rd
c87ee7ae255f81a25c605d7a592e411a *man/ison_adolescents.Rd
b23963ab1fa2d335889796aff99766df *man/ison_algebra.Rd
abb742a15b0d42220fdf1a9842343908 *man/ison_brandes.Rd
641f9e92c6a5a93938cb11af8f6680a2 *man/ison_karateka.Rd
3d3dae69f6654d22e5f1a3d769e95186 *man/ison_konigsberg.Rd
d2b34f7444de9f5f84b4194c4be507c4 *man/ison_laterals.Rd
6c3d2156439908d884fefe32f5cb8198 *man/ison_lawfirm.Rd
363a5584ba45f3d348b54de3ec6e37f1 *man/ison_lotr.Rd
872d6ffc4b2e0e3593bfff2c44ecf12d *man/ison_marvel.Rd
39018588f2ad52520528dcd51b837989 *man/ison_marvel.Rd
8af25118b798ee1918429e28c169580f *man/ison_networkers.Rd
489b7ee3f4807dc597cd78f6fa5d92a7 *man/ison_southern_women.Rd
f5cd8e08542281e8877896bb2f1e2679 *man/miss.Rd
f64eb245d4747839e5d137af2f8ffd1b *man/partition_layouts.Rd
389ed0f7a8c898a6f4e51eae2e4dedb6 *man/properties.Rd
83afbd68939135cccb533a3d78dfe13c *man/read.Rd
74cd9b0a7752d1047ee138a8936950bd *man/reexports.Rd
1c2ce582b3692c13cdee9ccde3c19ce4 *man/partition_layouts.Rd
d578057ec2a5db8039aa26764d2b3718 *man/properties.Rd
ee22c63fcf1ba72a300617b658cdcd69 *man/read.Rd
c8e1ec4e677f76dea30d29effffdcc95 *man/reexports.Rd
76dfe722f52ddcf2ba64725e261dfdf2 *man/reformat.Rd
98a4acacc3b543d909a6982eb1533054 *man/split.Rd
5aa570e908958357e0b8f0be069f4e5b *man/themes.Rd
Expand Down
29 changes: 29 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# manynet 0.2.3

2023-09-17

## Package

* Fixed URL in read_

# manynet 0.2.2

2023-09-17

## Package

* README now points to `{migraph}` earlier

## Tutorials

* Fixed various bugs in first (data) tutorial

## Map

* Fixed explicit node_shape bug

## Data

* Added `ison_lawfirm` data from Lazega, see documentation for more details
* Upgraded ison_marvel data to latest igraph specification

# manynet 0.2.1

2023-08-11
Expand Down
28 changes: 28 additions & 0 deletions R/data_ison.R
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,31 @@
#' ison_southern_women
#' ```
"ison_southern_women"

# Lawfirm ####

#' One-mode lawfirm (Lazega 2001)
#'
#' @description
#' One-mode network dataset collected by Lazega (2001)
#' on the relations between partners in a corporate law firm called SG&R in New England 1988-1991.
#' This particular subset includes the 36 partners among the 71 attorneys of this firm.
#' Nodal attributes include seniority, formal status, office in which they work, gender, lawschool they attended,
#' their age, and how many years they had been at the firm.
#' @details
#' The larger data from which this subset comes includes also individual performance measurements (hours worked, fees brought in)
#' and attitudes concerning various management policy options (see also `{sand}`),
#' their strong-coworker network, advice network, friendship network, and indirect control network.
#' @docType data
#' @keywords datasets
#' @name ison_lawfirm
#' @usage data(ison_lawfirm)
#' @references
#' Lazega, Emmanuel. 2001.
#' \emph{The Collegial Phenomenon: The Social Mechanisms of Cooperation Among Peers in a Corporate Law Partnership}.
#' Oxford: Oxford University Press.
#' @format
#' ```{r, echo = FALSE}
#' ison_lawfirm
#' ```
"ison_lawfirm"
2 changes: 1 addition & 1 deletion R/make_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#'
#' See also:
#'
#' - [networkdata](http://networkdata.schochastics.net/)
#' - [networkdata](https://schochastics.github.io/networkdata/)
#' - [GML datasets](http://www-personal.umich.edu/~mejn/netdata/)
#' - UCIrvine Network Data Repository
#' - [KONECT project](http://konect.cc/)
Expand Down
30 changes: 16 additions & 14 deletions R/map_autographr.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
#' @importFrom ggraph geom_edge_link geom_node_text geom_conn_bundle
#' get_con geom_node_point scale_edge_width_continuous geom_node_label
#' @importFrom ggplot2 aes arrow unit scale_color_brewer scale_fill_brewer
#' @name auto_graph
#' @name autographing
NULL

#' @describeIn auto_graph Graphs a network with sensible defaults
#' @describeIn autographing Graphs a network with sensible defaults
#' @examples
#' #ison_adolescents %>%
#' # mutate(shape = rep(c("circle", "square"), times = 4),
Expand All @@ -62,18 +62,18 @@ autographr <- function(.data,
# mutate(node_group = node_group)
# }
# Add layout ----
layout <- .infer_layout(g, layout)
p <- .graph_layout(g, layout, labels, ...)
g_layout <- .infer_layout(g, layout)
p <- .graph_layout(g, g_layout, labels, ...)
# Add edges ----
p <- .graph_edges(p, g, edge_color)
# Add nodes ----
p <- .graph_nodes(p, g, node_color, node_shape, node_size)
p
}

#' @describeIn auto_graph Graphs a list of networks
#' @describeIn autographing Graphs a list of networks
#' with sensible defaults
#' @param netlist A list of migraph-compatible networks.
#' @param netlist A list of manynet-compatible networks.
#' @source http://blog.schochastics.net/post/animating-network-evolutions-with-gganimate/
#' @examples
#' #autographs(to_egos(ison_adolescents))
Expand All @@ -91,7 +91,7 @@ autographs <- function(netlist, ...) {
do.call(patchwork::wrap_plots, gs)
}

#' @describeIn auto_graph Graphs an dynamic (animated) network
#' @describeIn autographing Graphs an dynamic (animated) network
#' with sensible defaults
#' @param tlist The same migraph-compatible network listed according to
#' a time attribute, waves, or slices.
Expand Down Expand Up @@ -186,12 +186,12 @@ autographd <- function(tlist, keep_isolates = TRUE, layout = "stress",
ggplot2::theme_void()
}

.infer_layout <- function(g, layout){
if(is.null(layout)){
if (is_twomode(g)) layout <- "hierarchy" else
layout <- "stress"
.infer_layout <- function(g, g_layout){
if(is.null(g_layout)){
if (is_twomode(g)) g_layout <- "hierarchy" else
g_layout <- "stress"
}
layout
g_layout
}

.infer_nsize <- function(g, node_size){
Expand Down Expand Up @@ -419,8 +419,10 @@ autographd <- function(tlist, keep_isolates = TRUE, layout = "stress",
nsize <- .infer_nsize(g, node_size)

if (!is.null(node_shape)) {
node_shape <- as.factor(node_attribute(g, node_shape))
node_shape <- c("circle","square","triangle")[node_shape]
if(length(node_shape) == 1) node_shape <- rep(node_shape, network_nodes(g)) else {
node_shape <- as.factor(node_attribute(g, node_shape))
node_shape <- c("circle","square","triangle")[node_shape]
}
} else if (is_twomode(g)) {
node_shape <- ifelse(igraph::V(g)$type,
"square",
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ them.
*That’s why `{manynet}` aims to help researchers with Making,
Manipulating, and Mapping networks.*

For Measures, Memberships, or Models, see
[`{migraph}`](https://snlab-ch.github.io/migraph/).

## Making

First, `{manynet}` provides a set of tools that can be used to make
Expand Down
Binary file modified build/partial.rdb
Binary file not shown.
Binary file added data/ison_lawfirm.rda
Binary file not shown.
Binary file modified data/ison_marvel_relationships.rda
Binary file not shown.
Binary file modified data/ison_marvel_teams.rda
Binary file not shown.
39 changes: 22 additions & 17 deletions inst/tutorials/tutorial1/data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ knitr::opts_chunk$set(echo = FALSE)

# Introduction

Network analysis is best with actual networks.
Most network analysts want to use network analysis to better understand empirical networks.
`{manynet}` offers several options for creating or generating,
importing or coercing networks into formats that you can use.
This tutorial is going to cover several ways to get data into the package:
Expand Down Expand Up @@ -116,7 +116,7 @@ question("How many nodes does this network have?",
```{r tblgraph-ties, echo = FALSE}
question("How many ties does this network have?",
answer(4,
message = "There are four more ties beyond what is listed."),
message = "There are four more ties beyond the six that are listed."),
answer(10,
correct = TRUE,
message = "There are 10 ties."),
Expand All @@ -132,7 +132,7 @@ question("How many ties does this network have?",
```

```{r tblgraph-type, echo = FALSE}
question("From what is stated here, what kind of network is this?",
question("What kind of network is this? Choose all that apply.",
answer("Undirected",
correct = TRUE),
answer("Labelled",
Expand Down Expand Up @@ -395,12 +395,12 @@ To assign and immediately print the result, wrap the line in parentheses.

```{r southproj-solution}
ison_southern_women
(women <- to_mode1(ison_southern_women))
(events <- to_mode2(ison_southern_women))
(s_women <- to_mode1(ison_southern_women))
(s_events <- to_mode2(ison_southern_women))
```

```{r namemode1}
question("The first mode consists of...",
question("The first mode of the two-mode network consists of...",
answer("women named Evelyn, Laura, Theresa, etc",
correct = TRUE),
answer("events called E1, E2, E3, etc"),
Expand Down Expand Up @@ -454,17 +454,22 @@ to find out a) how many nodes there are in each of these networks,
b) what the names of the nodes are,
and c) what tie attributes there are in the networks.

```{r projprop, exercise = TRUE, exercise.setup = "southproj"}
```{r projprop-setup}
s_women <- to_mode1(ison_southern_women)
s_events <- to_mode2(ison_southern_women)
```

```{r projprop, exercise = TRUE}
```

```{r projprop-solution}
network_nodes(women)
node_names(women)
network_tie_attributes(women)
network_nodes(events)
node_names(events)
network_tie_attributes(events)
network_nodes(s_women)
network_nodes(s_events)
node_names(s_women)
node_names(s_events)
network_tie_attributes(s_women)
network_tie_attributes(s_events)
```

So we can see that the `to_mode*()` functions have created a network of only one of the modes in the network.
Expand All @@ -484,7 +489,7 @@ Retrieve the tie weights from your women projection.
Find the average (mean) of this vector of tie weights,
and the average (mean) tie weight overall.

```{r womenweights, exercise = TRUE}
```{r womenweights, exercise = TRUE, exercise.setup = "projprop-setup"}
```

Expand All @@ -501,9 +506,9 @@ mean(as_matrix(_____))
```

```{r womenweights-solution}
tie_weights(women)
mean(tie_weights(women))
mean(as_matrix(women))
tie_weights(s_women)
mean(tie_weights(s_women))
mean(as_matrix(s_women))
```

```{r womenweightsq}
Expand Down
2 changes: 1 addition & 1 deletion man/attributes.Rd

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

0 comments on commit cbef293

Please sign in to comment.