statnet / ergm.ego

Fit, Simulate and Diagnose Exponential-Family Random Graph Models to Egocentrically Sampled Network Data https://statnet.org
Other
14 stars 4 forks source link

mixingmatrix function not exported? #45

Closed martinamorris closed 3 years ago

martinamorris commented 3 years ago

This doesn't work:

> ergm.ego::mixingmatrix(egodata$main, "age.grp")

Error: 'mixingmatrix' is not an exported object from 'namespace:ergm.ego'

But:

> ?ergm.ego::mixingmatrix

brings up the appropriate help page.

Is there a reason mixingmatrix is not exported?

krivit commented 3 years ago

mixingmatrix() is defined in network. Only the methods for egocentric data are defined in ergm.ego.

martinamorris commented 3 years ago

ok. so is there a protocol for indicating this in man pages? ?ergm.ego::mixingmatrix shows this at the top of the man page mixingmatrix.egodata {ergm.ego}. normally i look at the thing in {} to figure out what package a function comes from. and i'd use that package to call the function with ::.

i know the :: syntax is relatively new, so it may not be entirely integrated with the structure of the help page. but it would help me to know that to call this function on an egodata object, you want to use network::mixingmatrix.

krivit commented 3 years ago

The :: syntax has always been around, but why do you need it? Does mixingmatrix(egodata$main, "age.grp") not work?

martinamorris commented 3 years ago

for scripts when i don't want to library ergm.ego, but want to use mixingmatrix on an egodata object.

krivit commented 3 years ago

I am curious what the use case for that is---when it's undesirable to library(ergm.ego)?

Anyway, to absolutely minimise the use of library(), try:

loadNamespace("ergm.ego") # Register ergm.ego's methods, but don't attach the package.
network::mixingmatrix(egodata$main, "age.grp")

If you had previously run library(network), then the network:: bit is not needed.

martinamorris commented 3 years ago

I am curious what the use case for that is---when it's undesirable to library(ergm.ego)?

in some descriptive scripts -- we make all the data in packages now so it can be revised/read in to scripts easily. some of the preliminary descriptive analyses don't really need to load in the ergm.ego package, and the :: syntax is a convenient solution there.

it's not a big deal, just a bit confusing.