Skip to content

Commit b8a383c

Browse files
committed
Fixed search.ergmProposals() to work with data.frame-format $rules.
1 parent 4466377 commit b8a383c

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: ergm
2-
Version: 4.13.0-8016
2+
Version: 4.13.0-8018
33
Date: 2026-03-20
44
Title: Fit, Simulate and Diagnose Exponential-Family Models for Networks
55
Authors@R: c(

R/ergm-terms-index.R

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ search.ergmProposals <- function(search, name, reference, constraints, packages)
864864
if (!missing(reference)) {
865865
for (t in which(found)) {
866866
term <-terms[[t]]
867-
if (! reference %in% (term$rules %>% map("Reference"))) {
867+
if (! reference %in% term$rules$Reference) {
868868
found[t]<-FALSE
869869
}
870870
}
@@ -875,7 +875,8 @@ search.ergmProposals <- function(search, name, reference, constraints, packages)
875875
for (constraint in constraints) {
876876
for (t in which(found)) {
877877
term <-terms[[t]]
878-
if (!constraint %in% (term$rules %>% map('Enforces') %>% unlist) && !constraint %in% (term$rules %>% map("`May Enforce`") %>% unlist)) {
878+
if (! constraint %in% (term$rules$Enforces |> unlist())
879+
&& ! constraint %in% (term$rules$`May Enforce` |> unlist())) {
879880
found[t]<-FALSE
880881
}
881882
}
@@ -907,13 +908,13 @@ search.ergmProposals <- function(search, name, reference, constraints, packages)
907908
term$name,
908909
term$title,
909910
term$description))
910-
for (rule in term$rules) {
911+
apply(term$rules, 1L, function(rule) {
911912
cat(sprintf(' Reference: %s Class: %s\n%s%s\n',
912913
rule$Reference,
913914
rule$Class,
914915
if (length(rule$Enforces) > 0) paste(" Enforces:", paste(rule$Enforces, collapse=" "), "\n") else "",
915916
if (length(rule$`May Enforce`) > 0) paste(" May Enforce:", paste(rule$`May Enforce`, collapse=" "), "\n") else ""))
916-
}
917+
})
917918
}
918919
}
919920
}else{
@@ -922,8 +923,11 @@ search.ergmProposals <- function(search, name, reference, constraints, packages)
922923
outText <- sprintf('%s\n %s\n', term$name, term$title)
923924
output<-c(output,outText)
924925
}
925-
cat("Found ",length(output)," matching ergm proposals:\n")
926-
cat(paste(output,collapse='\n'))
926+
if (length(output)) {
927+
cat("Found ", length(output), " matching ergm proposals:\n")
928+
cat(paste(output, collapse = "\n"))
929+
}else cat("No matching ergm proposals found.\n")
930+
927931
}
928932
invisible(output)
929933
}

0 commit comments

Comments
 (0)