Skip to content

Commit

Permalink
Added examples of directly specifying values in levels2=.
Browse files Browse the repository at this point in the history
references #563
  • Loading branch information
krivit committed Sep 29, 2024
1 parent b7751de commit 1afa77d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/get.node.attr.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ get.node.attr <- function(nw, attrname, functionname=NULL, numeric=FALSE) {
#' # Select via an index of a cell:
#' idx <- cbind(1,2)
#' summary(faux.mesa.high~mm("Sex", levels2=idx))
#' # Or, select by specific attribute value combinations, though note
#' # the names 'row' and 'col' and the order for undirected networks:
#' summary(faux.mesa.high~mm("Sex",
#' levels2 = I(list(list(row="M",col="M"),
#' list(row="M",col="F"),
#' list(row="F",col="M")))))
#'
#' # mm() term allows two-sided attribute formulas with different attributes:
#' summary(faux.mesa.high~mm(Grade~Race, levels2=TRUE))
Expand Down
6 changes: 6 additions & 0 deletions man/nodal_attributes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vignettes/nodal_attributes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ summary(faux.mesa.high~mm("Sex", levels2=M)+mm("Sex", levels2=t(M)))
# Select via an index of a cell:
idx <- cbind(1,2)
summary(faux.mesa.high~mm("Sex", levels2=idx))
# Or, select by specific attribute value combinations, though note the
# names 'row' and 'col' and the order for undirected networks:
summary(faux.mesa.high~mm("Sex",
levels2 = I(list(list(row="M",col="M"),
list(row="M",col="F"),
list(row="F",col="M")))))
```

The attributes of the `mm()` term can be a two-sided formula with different attributes:
Expand Down

0 comments on commit 1afa77d

Please sign in to comment.