Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

network.naedgecount

Identifying and Counting Missing Edges in a Network Object


Description

network.naedgecount returns the number of edges within a network object which are flagged as missing. The is.na network method returns a new network containing the missing edges.

Usage

## S3 method for class 'network'
is.na(x)

network.naedgecount(x, ...)

Arguments

x

an object of class network

...

additional arguments, not used

Details

The missingness of an edge is controlled by its na attribute (which is mandatory for all edges); network.naedgecount returns the number of edges for which na==TRUE. The is.na network method produces a new network object whose edges correspond to the missing (na==TRUE) edges of the original object, and is thus a covenient method of extracting detailed missingness information on the entire network. The network returned by is.na is guaranteed to have the same base network attributes (directedness, loopness, hypergraphicity, multiplexity, and bipartite constraint) as the original network object, but no other information is copied; note too that edge IDs are not preserved by this process (although adjacency obviously is). Since the resulting object is a network, standard coercion, print/summary, and other methods can be applied to it in the usual fashion.

It should be borne in mind that “missingness” in the sense used here reflects the assertion that an edge's presence or absence is unknown, not that said edge is known not to be present. Thus, the na count for an empty graph is properly 0, since all edges are known to be absent. Edges can be flagged as missing by setting their na attribute to TRUE using set.edge.attribute, or by appropriate use of the network assignment operators; see below for an example of the latter.

Value

is.na(x) returns a network object, and network.naedgecount(x) returns the number of missing edges.

Author(s)

Carter T. Butts buttsc@uci.edu

References

Butts, C. T. (2008). “network: a Package for Managing Relational Data in R.” Journal of Statistical Software, 24(2). https://www.jstatsoft.org/v24/i02/

See Also

Examples

#Create an empty network with no missing data
g<-network.initialize(5)
g[,]                        #No edges present....
network.naedgecount(g)==0   #Edges not present are not "missing"!

#Now, add some missing edges
g[1,,add.edges=TRUE]<-NA    #Establish that 1's ties are unknown
g[,]                        #Observe the missing elements
is.na(g)                    #Observe in network form
network.naedgecount(g)==4   #These elements do count!
network.edgecount(is.na(g)) #Same as above

network

Classes for Relational Data

v1.16.1
GPL (>= 2)
Authors
Carter T. Butts [aut, cre], David Hunter [ctb], Mark Handcock [ctb], Skye Bender-deMoll [ctb], Jeffrey Horner [ctb], Li Wang [ctb]
Initial release
2020-10-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.