statnet / network
Showing 3 of 5 files from the diff.
Other files ignored by Codecov
DESCRIPTION has changed.
ChangeLog has changed.

@@ -6,7 +6,7 @@
 6 6 `# David Hunter and Mark S. Handcock` 7 7 `# .` 8 8 `#` 9 - `# Last Modified 06/05/21` 9 + `# Last Modified 06/08/21` 10 10 `# Licensed under the GNU General Public License version 2 (June, 1991)` 11 11 `# or greater` 12 12 `#`
@@ -504,14 +504,18 @@
 504 504 ` if(!is.null(vattr)) #If given names, use 'em` 505 505 ` unames<-vattr` 506 506 ` #Initialize the network object` 507 - ` n<-switch(matrix.type, #Extract n based on matrix type` 508 - ` adjacency=dim(x)[1],` 509 - ` incidence=dim(x)[1],` 510 - ` bipartite=sum(dim(x)),` 511 - ` edgelist=max(x[,1:2]),` 512 - ` )` 513 - ` if(is.numeric(nattr)) #If given n, use it` 507 + ` if(is.numeric(nattr)){ #If given n, use it` 514 508 ` n<-nattr` 509 + ` }else{ ` 510 + ` if((matrix.type=="edgelist")&&(NROW(x)==0))` 511 + ` stop("Cannot determine network size from zero-length edgelist; assign an n attribute to use data of this type.\n")` 512 + ` n<-switch(matrix.type, #Extract n based on matrix type` 513 + ` adjacency=dim(x)[1],` 514 + ` incidence=dim(x)[1],` 515 + ` bipartite=sum(dim(x)),` 516 + ` edgelist=max(x[,1:2]),` 517 + ` )` 518 + ` }` 515 519 ` if(is.numeric(battr)) #If given bipartite info, use it` 516 520 ` bipartite<-battr` 517 521 ` `

@@ -6,7 +6,7 @@
 6 6 `# David Hunter and Mark S. Handcock` 7 7 `# .` 8 8 `#` 9 - `# Last Modified 06/06/21` 9 + `# Last Modified 06/08/21` 10 10 `# Licensed under the GNU General Public License version 2 (June, 1991)` 11 11 `# or greater` 12 12 `#`
@@ -306,19 +306,19 @@
 306 306 ` gn<-substitute(g)` 307 307 ` l<-dim(x)[2]` 308 308 ` #Remove loops if has.loops==FALSE` 309 - ` if(!has.loops(g)){` 309 + ` if((NROW(x)>0)&&(!has.loops(g))){` 310 310 ` cn<-colnames(x)` 311 311 ` x<-x[x[,1]!=x[,2],,drop=FALSE] #Remove loops` 312 312 ` colnames(x)<-cn` 313 313 ` }` 314 314 ` #Remove redundant edges if is.multiplex==FALSE` 315 - ` if(!is.multiplex(g)){` 315 + ` if((NROW(x)>0)&&(!is.multiplex(g))){` 316 316 ` cn<-colnames(x)` 317 317 ` if(is.directed(g)){` 318 - ` x<-x[!duplicated(x[,1:2]),,drop=FALSE]` 318 + ` x<-x[!duplicated(x[,1:2,drop=FALSE]),,drop=FALSE]` 319 319 ` }else{` 320 - ` x[,1:2]<-t(apply(x[,1:2],1,sort))` 321 - ` x<-x[!duplicated(x[,1:2]),,drop=FALSE]` 320 + ` x[,1:2]<-t(apply(x[,1:2,drop=FALSE],1,sort))` 321 + ` x<-x[!duplicated(x[,1:2,drop=FALSE]),,drop=FALSE]` 322 322 ` }` 323 323 ` colnames(x)<-cn` 324 324 ` }`

@@ -6,7 +6,7 @@
 6 6 `# David Hunter and Mark S. Handcock` 7 7 `# .` 8 8 `#` 9 - `# Last Modified 06/06/21` 9 + `# Last Modified 06/08/21` 10 10 `# Licensed under the GNU General Public License version 2 (June, 1991)` 11 11 `# or greater` 12 12 `#`
@@ -20,6 +20,7 @@
 20 20 `# is.discrete` 21 21 `# is.discrete.character` 22 22 `# is.discrete.numeric` 23 + `# which.matrix.type` 23 24 `#` 24 25 `######################################################################` 25 26
@@ -551,6 +552,8 @@
 551 552 ` out<-NA` 552 553 ` else if (diff(dim(x))==0) ` 553 554 ` out<-"adjacency"` 555 + ` else if (NROW(x)==0) #For a 0-row matrix, an empty edgelist is the best bet...` 556 + ` out<-"edgelist"` 554 557 ` else if (max(abs(x),na.rm=TRUE)==1 && max(abs(x-as.integer(x)),na.rm=TRUE)==0)` 555 558 ` out<-"bipartite"` 556 559 ` else if (max(abs(x-as.integer(x))[,1:2],na.rm=TRUE)==0 && min(x[,1:2],na.rm=TRUE)>0)`
 1 ```comment: false ``` 2 3 ```coverage: ``` 4 ``` status: ``` 5 ``` project: ``` 6 ``` default: ``` 7 ``` target: auto ``` 8 ``` threshold: 1% ``` 9 ``` informational: true ``` 10 ``` patch: ``` 11 ``` default: ``` 12 ``` target: auto ``` 13 ``` threshold: 1% ``` 14 ``` informational: true ```