Skip to content

Commit c31e8c2

Browse files
committed
Merge branch 'master' into v1.17
2 parents 712ab03 + 806f525 commit c31e8c2

7 files changed

Lines changed: 36 additions & 6 deletions

File tree

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ v1.17
1313
- mixingmatrix() now produces output inheriting from "table" rather than a list; its printing, handling of missing attributes, bipartite networks, and other scenarios has been improved.
1414
- as.mixingmatrix() has been added.
1515
- network now uses statnet::statnetStartupMessage().
16+
- Updated constructor code per Kurt Hornik's suggestion to future proof versus upcoming sapply() changes.
17+
- network.edgelist() now automagically prunes loops and redundant edges for networks that should not have them; previously, the function trusted the user not to supply such things (and would go ahead and make edges if asked to do so).
1618
v1.16
1719
- Converted get.vertex.attribute and list.vertex.attributes to generics for greater extensibility.
1820
- Updated tests to fix a color-related issue.

DESCRIPTION

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,19 @@ Authors@R: c(
1111
person("Li", "Wang", role=c("ctb"), email="lxwang@uw.edu"),
1212
person("Pavel N.", "Krivitsky", role=c("ctb"), email="pavel@statnet.org", comment=c(ORCID="0000-0002-9101-3362")),
1313
person("Brendan", "Knapp", role=c("ctb"), email="brendan.g.knapp@gmail.com", comment=c(ORCID="0000-0003-3284-4972")),
14-
person("Michał", " Bojanowski", role=c("ctb"), email="mbojanowski@kozminski.edu.pl"),
14+
person("Michał", "Bojanowski", role=c("ctb"), email="mbojanowski@kozminski.edu.pl"),
1515
person("Chad", "Klumb", role=c("ctb"), email="cklumb@gmail.com"))
16+
Author: Carter T. Butts [aut, cre],
17+
David Hunter [ctb],
18+
Mark Handcock [ctb],
19+
Skye Bender-deMoll [ctb],
20+
Jeffrey Horner [ctb],
21+
Li Wang [ctb],
22+
Pavel N. Krivitsky [ctb] (<https://orcid.org/0000-0002-9101-3362>),
23+
Brendan Knapp [ctb] (<https://orcid.org/0000-0003-3284-4972>),
24+
Michał Bojanowski [ctb],
25+
Chad Klumb [ctb]
26+
Maintainer: Carter T. Butts <buttsc@uci.edu>
1627
Depends: R (>= 2.10), utils
1728
Imports: tibble, magrittr, statnet.common (>= 4.4.1), stats
1829
Suggests:

R/coercion.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# David Hunter <dhunter@stat.psu.edu> and Mark S. Handcock
77
# <handcock@u.washington.edu>.
88
#
9-
# Last Modified 02/26/13
9+
# Last Modified 06/05/21
1010
# Licensed under the GNU General Public License version 2 (June, 1991)
1111
# or greater
1212
#

R/constructors.R

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# David Hunter <dhunter@stat.psu.edu> and Mark S. Handcock
77
# <handcock@u.washington.edu>.
88
#
9-
# Last Modified 02/26/13
9+
# Last Modified 06/05/21
1010
# Licensed under the GNU General Public License version 2 (June, 1991)
1111
# or greater
1212
#
@@ -305,6 +305,23 @@ network.edgelist<-function(x, g, ignore.eval=TRUE, names.eval=NULL, ...){
305305
#Set things up to edit g in place
306306
gn<-substitute(g)
307307
l<-dim(x)[2]
308+
#Remove loops if has.loops==FALSE
309+
if(!has.loops(g)){
310+
cn<-colnames(x)
311+
x<-x[x[,1]!=x[,2],,drop=FALSE] #Remove loops
312+
colnames(x)<-cn
313+
}
314+
#Remove redundant edges if is.multiplex==FALSE
315+
if(!is.multiplex(g)){
316+
cn<-colnames(x)
317+
if(is.directed(g)){
318+
x<-x[!duplicated(x[,1:2]),,drop=FALSE]
319+
}else{
320+
x[,1:2]<-t(apply(x[,1:2],1,sort))
321+
x<-x[!duplicated(x[,1:2]),,drop=FALSE]
322+
}
323+
colnames(x)<-cn
324+
}
308325
#Traverse the edgelist matrix, adding edges as we go.
309326
if((l>2)&&(!ignore.eval)){ #Use values if present...
310327
#if names not given, try to use the names from data frame
@@ -441,9 +458,9 @@ network.initialize<-function(n,directed=TRUE,hyper=FALSE,loops=FALSE,multiple=FA
441458
g$gal$bipartite<-bipartite
442459
#Populate the vertex attribute lists, endpoint lists, etc.
443460
if(n>0){
444-
g$val<-replicate(n,list())
445-
g$iel<-replicate(n,vector(mode="integer"))
446-
g$oel<-replicate(n,vector(mode="integer"))
461+
g$val<-rep(list(list()), n)
462+
g$iel<-rep(list(integer()), n)
463+
g$oel<-rep(list(integer()), n)
447464
}else{
448465
g$val<-vector(length=0,mode="list")
449466
g$iel<-vector(length=0,mode="list")

src/symbols.rds

1.28 KB
Binary file not shown.
71.4 KB
Binary file not shown.

vignettes/networkVignette.pdf

-156 KB
Binary file not shown.

0 commit comments

Comments
 (0)