From cee31aee87945e6a7c17ecd076ae55e45720618f Mon Sep 17 00:00:00 2001
From: "Pavel N. Krivitsky"
Date: Mon, 30 Jan 2023 15:25:46 +1100
Subject: [PATCH] When network() propagates arguments to as.network(), use
match.call() and eval.parent() rather than passing arguments through by name,
thus preserving missing() information.
---
R/constructors.R | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/R/constructors.R b/R/constructors.R
index a633d1f..b7033f2 100644
--- a/R/constructors.R
+++ b/R/constructors.R
@@ -43,8 +43,11 @@ network<-function(x, vertex.attr=NULL, vertex.attrnames=NULL,
multiple=FALSE, bipartite=FALSE, ...)
{
#Initialize the network object
- g<-as.network(x,directed=directed,hyper=hyper,loops=loops,
- multiple=multiple,bipartite=bipartite,...)
+ mc <- match.call()
+ mc$vertex.attr <- NULL
+ mc[[1]] <- as.name("as.network")
+ g <- eval.parent(mc)
+
#Add vertex attributes, if needed
if(!is.null(vertex.attr)){
#Create vertex attribute names, if needed