Skip to content

Commit

Permalink
version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ authored and cran-robot committed Jun 15, 2023
1 parent bdb00c2 commit 337f271
Show file tree
Hide file tree
Showing 33 changed files with 1,190 additions and 441 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: dogesr
Type: Package
Title: Work with the Doges/Dogaresse Dataset
Version: 0.3.0
Version: 0.4.0
Author: Juan Julián Merelo-Guervós
Maintainer: Juan Julián Merelo-Guervós <jjmerelo@gmail.com>
Description: Work with data on Venetian doges and dogaresse and the noble families of the Republic of Venice, and use it for social network analysis, as used in Merelo (2022) <arXiv:2209.07334>.
Expand All @@ -16,6 +16,6 @@ VignetteBuilder: knitr
RdMacros: Rdpack
RoxygenNote: 7.2.1
NeedsCompilation: no
Packaged: 2023-05-28 10:35:59 UTC; jmerelo
Packaged: 2023-06-15 10:09:39 UTC; jmerelo
Repository: CRAN
Date/Publication: 2023-05-28 10:50:02 UTC
Date/Publication: 2023-06-15 10:50:02 UTC
55 changes: 31 additions & 24 deletions MD5
@@ -1,42 +1,49 @@
6e04fbea60d96929662d726108dd4e21 *DESCRIPTION
c983aa75df1f15c8a7a830fe096c224e *NAMESPACE
d92efb0a4090c7c81fb6898590f9b5ed *NEWS.md
72bf3da7a72ebe1a398e152a10d1d524 *DESCRIPTION
2fffc5ac6f14c8ca4bf72103687c10aa *NAMESPACE
72108faa8562fc119253eafab534c816 *NEWS.md
5ca494860f345762e5ca20ebc046b926 *R/doges.R
f36ed16094b6087ce0479669daab0694 *R/doges.years.R
caa74c35eb1f53d4fd4fd235b8b02b30 *R/families.R
3a1c03bd199b898a984b8de910f92452 *R/marriage.graph.R
ef265897a607ae18c2547f4981f28a6c *README.md
29fe6fd08c57f358097aecf63ff18023 *build/partial.rdb
6d2a9c08ed7c19c3e1dc7d393c2c04d9 *build/vignette.rds
7e95790fa128a88770ca99dac476046f *data/doge.families.rda
0dfdd32a261427efce1497ff43c50bf8 *data/doges.marriages.rda
883614ca55eff4644a3e40dbe24cdef4 *data/doges.rda
77e2a2bc9b38abac7cf1a887602c5fd7 *R/marriage.graph.R
c6823e379f6432d8f780a12900289f37 *R/marriage.graph.slice.R
a80a70a5c9afe7eda37a9854b2ca7222 *README.md
7e18666c56215cafc2c394f982144f6b *build/partial.rdb
9452068e2fbfee1956973fd32e7d87e6 *build/vignette.rds
660f8bab876041f72ee00ff1f51d3159 *data/doge.families.rda
9ccc2d940145adf28aedcc878acea3fd *data/doges.marriages.rda
e9f50d517a7eb633aee5d65836485067 *data/doges.rda
3b76e2fd1fd95bf79e2a4ae96a7e6fc0 *data/doges.years.rda
6c21d60801f2ba759fc31d6489113df3 *data/families.rda
10aa16960c1b73d31f5227da9730ba02 *inst/REFERENCES.bib
6a25bdc08e78429c8909e1de9cad3026 *inst/doc/counting-doge-families.R
5a2585a9407c1f9fad2a9a5f146d1dd5 *inst/doc/counting-doge-families.Rmd
36d13ff711cec3c5f417aa7453eb1660 *inst/doc/counting-doge-families.html
380169b4531a27cb1691536102f1a631 *inst/doc/counting-doge-families.html
350f5d9a9e0a5eb5a30348ae7696ae27 *inst/doc/doges-family-types.R
9f3f78c5216d6c37e9a2857b4ce799c1 *inst/doc/doges-family-types.Rmd
77fb6d71781b0e1428c78d77aa1e76c5 *inst/doc/doges-family-types.html
dba77f048d676f4adf5da41b38e6eca1 *inst/doc/doges-family-types.html
00e7cf8fdf6c27b11130a10fd93706be *inst/doc/doges-social-network.R
10fc93d4697d24d9673bdf82069d7b4f *inst/doc/doges-social-network.Rmd
4380da2f12bc7732609c4d9074db07b5 *inst/doc/doges-social-network.html
61862bef8c7d863295e3e6c0624aacd5 *inst/doc/doges-terms.R
9e70d0db982fe1ed4ee311fd75e0ea0e *inst/doc/doges-terms.Rmd
fbc534a28aac08b7b19fb24dc2818211 *inst/doc/doges-terms.html
b0ff3a52065853aedb34851db83622cb *inst/doc/doges-social-network.Rmd
ccd9bd7e514c167276a316dbf6f0b8ef *inst/doc/doges-social-network.html
a74e2f92fefe60d7bb6eefa64d82db0e *inst/doc/doges-split-social-network.R
7d5799a8b1231861a880721436629e06 *inst/doc/doges-split-social-network.Rmd
005af736e24061a814ea88c900c25315 *inst/doc/doges-split-social-network.html
161bdc49e7dbc2e07d4d16a9f850ee69 *inst/doc/doges-terms.R
701c7cd2c68b8ffba018aab49160d854 *inst/doc/doges-terms.Rmd
94e7665670680af84a9f91c2bccb15da *inst/doc/doges-terms.html
3c1b99fa60e54953f433b178b7d87f91 *inst/doges.bib
67c172b488abd266e3c350306e43fd46 *man/doge.families.Rd
0e184505f55c8dc69ddc12ca4f08c665 *man/doges.Rd
5041838acbb727af7fc3591935f9e297 *man/doges.marriages.Rd
eb1370e88a84f107ae159e449e235c6b *man/doges.years.Rd
d57174905c8ee8aef9c35372d811ea10 *man/doges.years.Rd
f214f1277343c214e61f1b117a39115e *man/families.Rd
cc0c8409c340c8b5efce90c8bad3d62b *man/marriage.graph.Rd
f2187d2d510a86dcb52a4db674aa8c1e *man/marriage.graph.slice.Rd
1d971f3ebe61e9a030d862e2a0eb2c63 *tests/testthat.R
9649b861ab1a5f3b92b303511e558ddf *tests/testthat/test-dogesdata.R
1c7c606abf4483566e42485c77687f41 *tests/testthat/test-dogesyearsdata.R
a858fa0b763bc9da841c99e54aba72b2 *tests/testthat/test-marriagegraph.R
67e4c0cb56799101d4a6638e7f433e3d *tests/testthat/test-dogesdata.R
d1e14f44066332f94e32fb06e4cbdcf0 *tests/testthat/test-dogesyearsdata.R
ba438b58fc6557e9584c71c25ba3ff19 *tests/testthat/test-marriagegraph-slice.R
d1d368569da96d95b9220b861996b2d5 *tests/testthat/test-marriagegraph.R
5a2585a9407c1f9fad2a9a5f146d1dd5 *vignettes/counting-doge-families.Rmd
9f3f78c5216d6c37e9a2857b4ce799c1 *vignettes/doges-family-types.Rmd
10fc93d4697d24d9673bdf82069d7b4f *vignettes/doges-social-network.Rmd
9e70d0db982fe1ed4ee311fd75e0ea0e *vignettes/doges-terms.Rmd
b0ff3a52065853aedb34851db83622cb *vignettes/doges-social-network.Rmd
7d5799a8b1231861a880721436629e06 *vignettes/doges-split-social-network.Rmd
701c7cd2c68b8ffba018aab49160d854 *vignettes/doges-terms.Rmd
2 changes: 1 addition & 1 deletion NAMESPACE
Expand Up @@ -5,4 +5,4 @@ import(qpdf)
import(rmarkdown)
import(ggplot2)
importFrom(Rdpack,reprompt)
importFrom(igraph,graph.data.frame)
importFrom(igraph,graph.data.frame,V,"V<-")
11 changes: 11 additions & 0 deletions NEWS.md
@@ -1,3 +1,14 @@
# doges 0.4.0

Fixes:
* Adds a missing doge to the dataset
* Fixes years in office so that they match each other

Changes:
* Changes doges.years to dataset, not function
* Adds marriage.graph.slice
* marriage.graph now adds family type

# doges 0.3.0

Fixes:
Expand Down
19 changes: 0 additions & 19 deletions R/doges.years.R

This file was deleted.

9 changes: 7 additions & 2 deletions R/marriage.graph.R
@@ -1,12 +1,17 @@
globalVariables(c("doges.marriages.sn"))
library(igraph)

globalVariables(c("doges.marriages.sn","family.types"))

#' Convert doges data into a social graph
#'
#' @return An graph with noble families as nodes, edges representing marriages of doges or parents
#' @importFrom igraph V V<-
#'
#' @return A graph with noble families as nodes, edges representing marriages of doges or parents; the type of family is the attribute family.type
#' @export
#'
#

marriage.graph <- function() {
V(doges.marriages.sn)$family.type <- sapply( V(doges.marriages.sn)$name, function(x) family.types[x] )
return(doges.marriages.sn)
}
25 changes: 25 additions & 0 deletions R/marriage.graph.slice.R
@@ -0,0 +1,25 @@
library(igraph)

globalVariables(c("data.doges"))

#' Convert doges data into a social graph
#' @param from Exact name of the doge, Orso (first doge) by default
#' @param to Exact name of the last doge, Ludovico Manin (last one) by default
#' @return A graph with noble families as nodes, edges representing marriages of doges or parents; the type of family is the attribute family.type
#' @export
#'
#

marriage.graph.slice <- function(..., from="Orso",to="Ludovico Manin") {
from.index <- which(data.doges$Doge == from )[1]
to.values <- which(data.doges$Doge == to )
to.index <- to.values[length(to.values)]
sliced <- data.doges[from.index:to.index,]
doges.marriages.df <- data.frame(sliced$Family.doge,sliced$Family.dogaressa)
doges.marriages.df <- doges.marriages.df[ (doges.marriages.df$sliced.Family.doge != '' ) & (doges.marriages.df$sliced.Family.dogaressa != ''),]
doges.mothers.df <- data.frame(sliced$Family.doge,sliced$Family.mother)
doges.mothers.df <- doges.mothers.df[ (doges.mothers.df$sliced.Family.doge != '' ) & (doges.mothers.df$sliced.Family.mother != ''),]
all.links <- data.frame(doge.or.father = c(doges.marriages.df$sliced.Family.doge,doges.mothers.df$sliced.Family.doge),
dogaressa.or.mother = c(doges.marriages.df$sliced.Family.dogaressa,doges.mothers.df$sliced.Family.mother))
return(graph.data.frame(all.links,directed=F))
}
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -5,8 +5,6 @@

# dogesR

> **Hacktoberfest**: check the [help wanted](https://github.com/JJ/dogesr/labels/help%20wanted) issues
Module (with data) to work with the dogi and dogaresse of the Venetian
republic. Main intention is to analyze social networks resulting from marriages
and other interactions.
Expand Down Expand Up @@ -46,6 +44,7 @@ This package includes a couple of vignettes. Once installed, write `vignette("do
* `vignette("doges-family-types")` for how to use the family types data set
* `vignette("doges-terms")` to analyze the amount of time the doges lived/ruled using data provided in this package.
* `vignette("doges-social-network")` to get the marriage social network of doges and parents, and make some initial exploration.
* `vignette("doges-split-social-network")` to get the marriage social network of doges and parents for slices of time, from and to specific doges; this one shows how to get the social network before and after the Serrata.
* `vignette("counting-doge-families")` to work with a table of the families doges belonged to and how many times they actually "made doge"

## Work with data
Expand Down
Binary file modified build/partial.rdb
Binary file not shown.
Binary file modified build/vignette.rds
Binary file not shown.
Binary file modified data/doge.families.rda
Binary file not shown.
Binary file modified data/doges.marriages.rda
Binary file not shown.
Binary file modified data/doges.rda
Binary file not shown.
Binary file added data/doges.years.rda
Binary file not shown.
18 changes: 9 additions & 9 deletions inst/doc/counting-doge-families.html
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="JJ Merelo" />

<meta name="date" content="2023-05-28" />
<meta name="date" content="2023-06-15" />

<title>Using dogesr to find out about the doges families</title>

Expand Down Expand Up @@ -363,7 +363,7 @@
<h1 class="title toc-ignore">Using <code>dogesr</code> to find out about
the doges families</h1>
<h4 class="author">JJ Merelo</h4>
<h4 class="date">2023-05-28</h4>
<h4 class="date">2023-06-15</h4>



Expand All @@ -384,17 +384,17 @@ <h2>Introduction</h2>
<div id="set-up" class="section level2">
<h2>Set up</h2>
<p>We load the dataset needed, called <code>doge.families</code>.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># library(&quot;dogesr&quot;) # If you have already installed this package</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>devtools<span class="sc">::</span><span class="fu">load_all</span>(<span class="st">&quot;.&quot;</span>) <span class="co"># Comment this, uncomment above if you have installed this package</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="fu">data</span>(<span class="st">&quot;doge.families&quot;</span>)</span></code></pre></div>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="co"># library(&quot;dogesr&quot;) # If you have already installed this package</span></span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a>devtools<span class="sc">::</span><span class="fu">load_all</span>(<span class="st">&quot;.&quot;</span>) <span class="co"># Comment this, uncomment above if you have installed this package</span></span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a><span class="fu">data</span>(<span class="st">&quot;doge.families&quot;</span>)</span></code></pre></div>
<p>This will import the data from the <code>dogesr</code> package into
the <code>doge.families</code> <em>tibble</em>.</p>
</div>
<div id="ranking-families" class="section level2">
<h2>Ranking families</h2>
<p>Here’s the ranking of the families with the highest number of doges;
the Contarinis and Morosinis, right on top.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">kable</span>(<span class="fu">head</span>(doge.families[<span class="fu">order</span>(<span class="sc">-</span>doge.families<span class="sc">$</span>n),],<span class="at">n=</span><span class="dv">10</span>),<span class="at">row.names=</span>F,<span class="at">col.names=</span><span class="fu">c</span>(<span class="st">&quot;Doge family&quot;</span>,<span class="st">&quot;Number of doges&quot;</span>))</span></code></pre></div>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">kable</span>(<span class="fu">head</span>(doge.families[<span class="fu">order</span>(<span class="sc">-</span>doge.families<span class="sc">$</span>n),],<span class="at">n=</span><span class="dv">10</span>),<span class="at">row.names=</span>F,<span class="at">col.names=</span><span class="fu">c</span>(<span class="st">&quot;Doge family&quot;</span>,<span class="st">&quot;Number of doges&quot;</span>))</span></code></pre></div>
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -447,9 +447,9 @@ <h2>Ranking families</h2>
</table>
<p>Which types of families are these? We can use data from the rest of
the packages to find out:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">data</span>(<span class="st">&quot;families&quot;</span>)</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>doge.families<span class="sc">$</span>type <span class="ot">&lt;-</span> <span class="fu">unname</span>(family.types[doge.families<span class="sc">$</span>Family.doge])</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">kable</span>(<span class="fu">head</span>(doge.families[<span class="fu">order</span>(<span class="sc">-</span>doge.families<span class="sc">$</span>n),],<span class="at">n=</span><span class="dv">20</span>) <span class="sc">%&gt;%</span> <span class="fu">select</span>(<span class="dv">1</span>,<span class="dv">3</span>),<span class="at">row.names=</span>F,<span class="at">col.names=</span><span class="fu">c</span>(<span class="st">&quot;Doge family&quot;</span>,<span class="st">&quot;Family type&quot;</span>))</span></code></pre></div>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="fu">data</span>(<span class="st">&quot;families&quot;</span>)</span>
<span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a>doge.families<span class="sc">$</span>type <span class="ot">&lt;-</span> <span class="fu">unname</span>(family.types[doge.families<span class="sc">$</span>Family.doge])</span>
<span id="cb3-3"><a href="#cb3-3" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">kable</span>(<span class="fu">head</span>(doge.families[<span class="fu">order</span>(<span class="sc">-</span>doge.families<span class="sc">$</span>n),],<span class="at">n=</span><span class="dv">20</span>) <span class="sc">%&gt;%</span> <span class="fu">select</span>(<span class="dv">1</span>,<span class="dv">3</span>),<span class="at">row.names=</span>F,<span class="at">col.names=</span><span class="fu">c</span>(<span class="st">&quot;Doge family&quot;</span>,<span class="st">&quot;Family type&quot;</span>))</span></code></pre></div>
<table>
<thead>
<tr class="header">
Expand Down
398 changes: 212 additions & 186 deletions inst/doc/doges-family-types.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/doc/doges-social-network.Rmd
Expand Up @@ -48,7 +48,7 @@ doges.sn.connected <- igraph::induced_subgraph(doges.sn, vert_ids)
plot(doges.sn.connected,vertex.size=V(doges.sn.connected)$degree,layout=layout_with_fr, vertex.label.cex=0.7)
```

This already shows (roughly) the power-law structure that was already evident in [@dogesr]; however, looking at Figure 1 in that paper, we see that some families that were "excluded" if doges' parents are not included in the social network, are now part of the connected component. The Lando, Pasqualigo and Querini families were then "outside", and they are now linked through some matrilinear relationship. We'll check now which are the links in this case, as well as other that were also isolated previously.
This already shows the multi-center structure, with several strong families as nuclei, that was already evident in [@dogesr]; however, looking at Figure 1 in that paper, we see that some families that were "excluded" if doges' parents are not included in the social network, are now part of the connected component. The Lando, Pasqualigo and Querini families were then "outside", and they are now linked through some matrilinear relationship. We'll check now which are the links in this case, as well as other that were also isolated previously.

```{r newlinks}
for (f in c("Pasqualigo","Foscari","Querini")) {
Expand Down
68 changes: 34 additions & 34 deletions inst/doc/doges-social-network.html

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions inst/doc/doges-split-social-network.R
@@ -0,0 +1,28 @@
## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)

## ----load, warning=FALSE,message=FALSE----------------------------------------
library(dogesr)
library(igraph)

pre.serrata <- marriage.graph.slice(to="Pietro Gradenigo")
post.serrata <- marriage.graph.slice(from="Marino Zorzi")

## ----simplify-----------------------------------------------------------------
weightify <- function( a.graph ) {
other.graph <- a.graph
E(other.graph)$weight <- 1
other.graph <- simplify(other.graph, edge.attr.comb=list(weight="sum"))
return(other.graph)
}
pre.serrata <- weightify(pre.serrata)
post.serrata <- weightify(post.serrata)

V(pre.serrata)$EV <- unname(unlist(eigen_centrality(pre.serrata)$vector))
V(post.serrata)$EV <- unname(unlist(eigen_centrality(post.serrata)$vector))
plot(pre.serrata,vertex.size=V(pre.serrata)$EV, layout=layout_nicely, vertex.label.cex=0.7)
plot(post.serrata,vertex.size=V(post.serrata)$EV, layout=layout_nicely, vertex.label.cex=0.7)

0 comments on commit 337f271

Please sign in to comment.