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