@@ -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