nwkeep

Keep a network (or only certain nodes)

Syntax

nwkeep 
[netlist]
nwkeep 
[netname]
ifin
[,
clean]
   
clean Drop node observations

Description

Keeps a network or a list of networks. The command is the network version of keep and mirrors nwdrop.

It can also be used together with if or in. In this case, the command operates on the node-level and keeps only certain nodes of a network.

Examples

Load two networks and keep only one of them by name:

. nwclear
. nwrandom 5, prob(.4) name(net1)
. nwrandom 5, prob(.4) name(net2)
. nwkeep net2
. nwset

Keep only certain nodes of a network, using if:

. nwclear
. nwrandom 6, prob(.4) name(net3)
. nwkeep net3 if _n <= 3
. nwsummarize net3

Back to top

nwcommands is free to install and use, including for commercial research. See the GitHub repository for source, license, and issue tracking.

This site uses Just the Docs, a documentation theme for Jekyll.