Skip to content

Commit c4d87be

Browse files
committed
ergmProposal documentation parser now works with the new ergm_proposal_table() format.
1 parent d051b8b commit c4d87be

2 files changed

Lines changed: 11 additions & 21 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.12.1-8013
2+
Version: 4.12.1-8014
33
Date: 2026-03-19
44
Title: Fit, Simulate and Diagnose Exponential-Family Models for Networks
55
Authors@R: c(

R/ergm-terms-index.R

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,17 @@ DISPLAY_LATEX_TOC_PCT_WIDTHS <- function(n_concepts) c(2.4, rep(.7, n_concepts))
8080
ps <- ergm_proposal_table()
8181
ps <- .filterProposals(ps, proposal=comps[1])
8282

83-
proposals = list()
84-
for (i in seq_len(nrow(ps))) {
85-
if (!stringr::str_detect(ps$Constraints[i], '[|&]') || stringr::str_detect(ps$Constraints[i], '\\+')) {
86-
constraints <- strsplit(ps$Constraints[i], '\\+')[[1]]
87-
constraints <- paste0(ifelse(constraints == '.dyads', '|', '&'), constraints)
88-
} else {
89-
constraints <- strsplit(ps$Constraints[i], '(?<=.)(?=[|&])', perl=TRUE)[[1]]
90-
}
91-
constraints <- lapply(constraints, function(c) list(
92-
name=substr(c, 2, stringr::str_length(c)),
93-
enforce=substr(c, 1, 1) == '&'))
94-
proposals[[length(proposals) + 1]] <- list(
95-
Proposal=ps$Proposal[i],
96-
Reference=ps$Reference[i],
97-
Enforces=constraints %>% keep("enforce") %>% map("name") %>% unlist,
98-
May_Enforce=constraints %>% discard("enforce") %>% map("name") %>% unlist,
99-
Priority=ps$Priority[i],
100-
Weight=ps$Weights[i],
101-
Class=ifelse(ps$Class[i] == 'c', 'cross-sectional', 'last-toggle')
83+
proposals <- with(ps, map(seq_along(Proposal), function(i) {
84+
list(
85+
Proposal = Proposal[i],
86+
Reference = Reference[i],
87+
Enforces = Constraints[[i]]$does,
88+
May_Enforce = c(Constraints[[i]]$can, if (Constraints[[i]]$can_any) "*"),
89+
Priority = Priority[i],
90+
Weight = Weights[i],
91+
Class = ifelse(Class[i] == "c", "cross-sectional", "last-toggle")
10292
)
103-
}
93+
}))
10494
return(list(
10595
link=rdname,
10696
name=comps[1],

0 commit comments

Comments
 (0)